From patchwork Wed May 30 10:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10438291 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 8C6DB602CC for ; Wed, 30 May 2018 10:02:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CDDF288ED for ; Wed, 30 May 2018 10:02:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 720AF288F1; Wed, 30 May 2018 10:02:01 +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 E8C59288ED for ; Wed, 30 May 2018 10:02:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D010E6B028D; Wed, 30 May 2018 06:01:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CB3016B028E; Wed, 30 May 2018 06:01:20 -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 B79BC6B028F; Wed, 30 May 2018 06:01:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id 721C66B028D for ; Wed, 30 May 2018 06:01:20 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id w6-v6so9079648plp.14 for ; Wed, 30 May 2018 03:01:20 -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=kGd2Um93wQm1nLUh7RIztVpo1DMTbt0PkwmA/t0Rkw0=; b=EGpE4HlfqHBux9r6H6C4cOXhxHl/0jAqNY2rOyC8qZnzqGraNTPzTlWfxWfc7avPIz Cboo4Fj2txf8neDHY1Xyo2cS1FC1lcO5wOzAQ3/TlyaW8Hu0c3FH7UElcFqwDzaReJ2S nHtYf4MXSXciuh1xT83thVJmg/wqt125GIV5ubO7dcjak3Z8fNr77MvuDMz5rT48FKic HtS/rOkE7UGcG60ZxClQEMDTEFgHtHsc1wGsMqoEqW0XtjSNDm9E77jKP5/VrR3OXnI/ 5MF44lCKUT7GMEVaXEXcX1vxtSKKEsVOC526+VawgVKuOEx4hG3LlppcQMvKzaqJ/OaH b+IQ== X-Gm-Message-State: ALKqPwcKhuYW1f/TzygiTiOV4iPwgnYpT/P/nBYHRFemJR6nS1T1rmsB 11QbdsirlFwuQuPDiXMfqkxvnhUQ8F1/dqvndwNlNPB6bzTZQ/voKpPr+h+5JjNd0XUTa7eIec0 YZbw767EzNudVP+Kma0zYrHyl4ZSSYnlNekCB+JiadgIvD4GvTlKtB8Fjdv5Q5hI= X-Received: by 2002:a63:9d8e:: with SMTP id i136-v6mr1665555pgd.288.1527674480167; Wed, 30 May 2018 03:01:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJv7F2E66rLpudWXn4/ymnQmnAIk1TimPQ8rEIICEnE73KDkHwoafofLddkW25L31UEwizm X-Received: by 2002:a63:9d8e:: with SMTP id i136-v6mr1665503pgd.288.1527674479400; Wed, 30 May 2018 03:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527674479; cv=none; d=google.com; s=arc-20160816; b=DaQEbt46neZyagJjq+aMB8wt7mzY4O5N6kDUzdBmD0DOX7Ix4Em70fwuGxxyRmQfMu U2TKe1Q74Ls50ljXBuC2XbSV3U5RsZqxcTTmQqEJCXwCNR2Qy+qn0wz0P8x8O7FDQxpT G5JMNNfpURUzvIuMUjIpZIm9loYhxiNpBudElTe5R3r9sFkkoFR2EojLcFgdeya2n7/0 IdjHiHgATaL/TA1kl1ndNy/BBgoA5A1671ZTKT+z+7JHfjd+QULdAHygPa4jdW09X11R LukEz9LMVvkpHe9QqZzSKd/hiv+OqGlBRXZfTiNtl3VFcbYdhlJyUpxP7G8XyCz++jxx rkdg== 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=kGd2Um93wQm1nLUh7RIztVpo1DMTbt0PkwmA/t0Rkw0=; b=J8/pOJSpcrFZ6uHl992YT1V7jL3qcw+hDMuyx8YZ3kwzHgYfB8Q3sZkJzO9K/5iA12 OqpzsmUviqL0iTQkWb8F7hij+tteEP4rO1dr0PEcsqmZU8FRC8VAYjPDarLEpxlnMYKH VyeL3emomprWZ2874FgSYhgd5I5Re4rVFY6F3waiXxv/NtMUlN+tGE2Zz9IuZIeBxdbh E3FrObz17fcrlvQkwazpVWKHhVkBjYtqtKn3IGusasBXXvWcH+EIQqtQcitIDT5lScVo CQcQ6IFednug2w+U2wRD5bDtDWeu/Iyo7QQNXa6gE4/ns/cReaQiNRl/HB7AXd9Qeo61 C66A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=eTN18l84; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+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 3-v6si35304391plf.84.2018.05.30.03.01.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 03:01:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+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=eTN18l84; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+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=kGd2Um93wQm1nLUh7RIztVpo1DMTbt0PkwmA/t0Rkw0=; b=eTN18l84qFrLl85l3068hKwUf 1HbR9AMuWo+sw3bgostu/n9IwYZ9vCI5ghRsnumksFioWTF7pnh34YRBfr3cORGTM1RnH3lTPKKM7 6I00MDh3iI04kcETDP3Lh5T82/9DIoDu3kj1jsOICG2+2Ty9HMsHXyh4EiuEpq5wVyoLVUNbJK7uc +fff7JWSQj7I5jvkMof/ddoaH/qXU725yEr3jW4JmK9Lhr9UklV3mgBndqcYUcAps7UqWs+NIoqn9 Yy52pSDX7SkoV1Uk7YF3WYXpyqacH9QaDgR/xhsBYIptgrXhkBfuVMyl02KYFjzHC5FyzRkZiIHAN 8J6Iet8UA==; Received: from 213-225-38-123.nat.highway.a1.net ([213.225.38.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNxuv-00005n-LW; Wed, 30 May 2018 10:01:18 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 14/18] xfs: move all writeback buffer_head manipulation into xfs_map_at_offset Date: Wed, 30 May 2018 12:00:09 +0200 Message-Id: <20180530100013.31358-15-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530100013.31358-1-hch@lst.de> References: <20180530100013.31358-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 Reviewed-by: Darrick J. Wong Reviewed-by: Brian Foster --- 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 7d02d04d5a5b..025f2acac100 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -495,21 +495,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, @@ -718,6 +703,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); @@ -730,6 +716,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 @@ -875,11 +865,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++; }