From patchwork Wed May 23 14:43:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10421657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96E126032A for ; Wed, 23 May 2018 14:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87DC9289B1 for ; Wed, 23 May 2018 14:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D00028B00; Wed, 23 May 2018 14:46:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C011289B1 for ; Wed, 23 May 2018 14:46:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 013946B0287; Wed, 23 May 2018 10:45:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E64D66B0288; Wed, 23 May 2018 10:45:36 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB6F16B0289; Wed, 23 May 2018 10:45:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 832EC6B0288 for ; Wed, 23 May 2018 10:45:36 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id q16-v6so14346959pls.15 for ; Wed, 23 May 2018 07:45:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=92MMTFi2IIgEg3iUDdObI12au0trYp073QMQb6Qdn94=; b=E+GBLTdeUxehsZaaW/R9ADc19V+qNDGbvGUn+WD3wDuCb7Osk6N8g1ZvRCkTBeWaHg njFy8HL6yUh76N4cyRnF3Bw1vGmlYJMxN1at3vK4ia7Ie0wIv6XZxUEzsD8HHK5S2OTJ /U3eMz7eevE9keNKVpC2YENA06GiSG26ROTVBSHjXfTkzKpR8JKecEGiiSqeSFwmmzbb tCL9bI2VOJvrmehKCqbmGXyPdSz7o3R8whHhwhcYwRRqa864QtdSeJ4xWJENFrVu3nfb bGvj4OQ2VcMebJaVisZ7jZttN1ED1Gxrum1+4pqBi1l8wkChsgkYH9ztIclbfXnO3Oo/ brHw== X-Gm-Message-State: ALKqPwfA39dinjTmnUbBayhcw9IikZplW9zJSoRkZ80nsP6zln7xDH1L VDHZUcJVeTOcBy6vfCRHIaicaNW+nWyGFiyQyu2mb13djY3YaJQjg3A/LgFBgl+L3S6ZgP3vgCs kZstn4wVKhHJSI+jsr1rVxKPOKbylxU6/8dItRiZ/RvJpqh7RDlJs678vj6jlIlk= X-Received: by 2002:a65:610d:: with SMTP id z13-v6mr2631024pgu.260.1527086736231; Wed, 23 May 2018 07:45:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq6WIF+sr2l3gZF+QDkUquLAtLQksib7dV8zKuyXvNip3916taZSuF2lHmEsqd18WNIVNOZ X-Received: by 2002:a65:610d:: with SMTP id z13-v6mr2630996pgu.260.1527086735340; Wed, 23 May 2018 07:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527086735; cv=none; d=google.com; s=arc-20160816; b=P8+tYuGa53v7Fy97mPJMVR9VinRq9edOVieYfc7rvKBYtlwjTZ0w9vdmHoPRlAfhpo ZkMzklKWe8cb13h/kKYMXkOA72kVNkHd7sEgkWzRlEyoLBam2lzbgHuvfJEBy+qZB7Dj 6VHHqgGutB9AtqFWeC71nUeOV2cxunA6EElduzc3PkE/WCvEGC74YCwk4gA0k5Sysij2 W+FEly728dYeEvwuFcVwwUgCAXDueFtNCLySHt2Am2zBH+0NuiLBHe57NFBu0JAr2PbX 93XuxM40OIPxVkkF+lucLRiUIV18eFZyLPfEcvNyuBkQzWjOLx1MpWavoLJlLI7Y7fAm OHGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=92MMTFi2IIgEg3iUDdObI12au0trYp073QMQb6Qdn94=; b=LcC7n9xDhwlagGqwI3/P7IKt4F5d5AS7BhxMbYqaHQ2kQzArLOzNIxuwzhXx3Xx/zQ T6SJ+Ep/BKnPMLzPdCfnDKYSa7nsyIxI/sarAd2/4gx9YGpaal3SUxJ4/ttQo0uW/gBX xszMkUwZ6DgjtQy/+qqWTmyGjniDjpGXvJzRz6IgLOCTMp+ahdxberDfMgw+yPatqCOT ik9q/4bhrs8JkbQB2I1Z8rpYk2tK8966MPy/jXDFg6xvqPEmumLktvae3Rkb/SUlekVz Uhh1W5Ty9EI2fniE6b0wuTy0E7wbfNmuW0d/gH00KhHZd8as1NWtutf6n8XeZQqUVcTI LP6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=iY13knGL; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id i12-v6si18311185plt.183.2018.05.23.07.45.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 07:45:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=iY13knGL; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=92MMTFi2IIgEg3iUDdObI12au0trYp073QMQb6Qdn94=; b=iY13knGLqOfKunO2esbzVkiCj WwpMe5Ie1KhUfaW0PZE/fiLVGDLI5upyEDg00zjjRtDRQVO1VuRdky8ljqrTef06ZZ5c52cOpKB1L YOpZR3ctESwce7dDx5abgUiiiUeLZhXH0Ucl5445+u4a+mbOJ0FmhPNbaejMxNCznGZKp3rZJuyRf zMl0SfhJoi0JUmvvaDY4ftZn7+hP0+N4/27M1J1MaqmwvqiRc2ezcBTra/In5VQCzYxLJhp+NIjGs q39ZwOjXRpeM2fvhoFGUuQIhrrzzF/dzQKKckzWX9syujhu9yxacY/tZBh/EibOAsiji53qIctIRr 60BciLdZQ==; Received: from 089144199016.atnat0008.highway.a1.net ([89.144.199.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLV1B-0001ok-1D; Wed, 23 May 2018 14:45:33 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 30/34] xfs: move all writeback buffer_head manipulation into xfs_map_at_offset Date: Wed, 23 May 2018 16:43:53 +0200 Message-Id: <20180523144357.18985-31-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523144357.18985-1-hch@lst.de> References: <20180523144357.18985-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This keeps it in a single place so it can be made otional more easily. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_aops.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 592b33b35a30..951b329abb23 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -505,21 +505,6 @@ xfs_imap_valid( offset < imap->br_startoff + imap->br_blockcount; } -STATIC void -xfs_start_buffer_writeback( - struct buffer_head *bh) -{ - ASSERT(buffer_mapped(bh)); - ASSERT(buffer_locked(bh)); - ASSERT(!buffer_delay(bh)); - ASSERT(!buffer_unwritten(bh)); - - bh->b_end_io = NULL; - set_buffer_async_write(bh); - set_buffer_uptodate(bh); - clear_buffer_dirty(bh); -} - STATIC void xfs_start_page_writeback( struct page *page, @@ -728,6 +713,7 @@ xfs_map_at_offset( ASSERT(imap->br_startblock != HOLESTARTBLOCK); ASSERT(imap->br_startblock != DELAYSTARTBLOCK); + lock_buffer(bh); xfs_map_buffer(inode, bh, imap, offset); set_buffer_mapped(bh); clear_buffer_delay(bh); @@ -740,6 +726,10 @@ xfs_map_at_offset( * set the bdev now. */ bh->b_bdev = xfs_find_bdev_for_inode(inode); + bh->b_end_io = NULL; + set_buffer_async_write(bh); + set_buffer_uptodate(bh); + clear_buffer_dirty(bh); } STATIC void @@ -885,11 +875,9 @@ xfs_writepage_map( continue; } - lock_buffer(bh); xfs_map_at_offset(inode, bh, &wpc->imap, file_offset); xfs_add_to_ioend(inode, file_offset, page, wpc, wbc, &submit_list); - xfs_start_buffer_writeback(bh); count++; }