From patchwork Wed May 9 07:48:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10388479 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 2E37E60540 for ; Wed, 9 May 2018 07:50:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2202228E05 for ; Wed, 9 May 2018 07:50:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16ADB28E68; Wed, 9 May 2018 07:50:23 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B48F528E05 for ; Wed, 9 May 2018 07:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933941AbeEIHuV (ORCPT ); Wed, 9 May 2018 03:50:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53324 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933383AbeEIHuR (ORCPT ); Wed, 9 May 2018 03:50:17 -0400 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=duvj9MIO5zqDFKTuLp0vgbevhIv50kVZ2/Yo6dpviRs=; b=qyTH1kqrfjRbERYArbsmQR58P nzPIhSdQxiHFLJPBUgNgo/vd/xx7obhhmr+TsStvQv4erV1jiBuYexZmqWVb37D19/a2DqszD3pe7 dd/kg2eWcLzSBs56KGCwtnXHDwJmBVvw2EW+m9hlME/OsEc0OIuOsWLBSP1Ev3sM16Hz0Ix2zUpaB IX7z5NiHpByeHkuAz1vaPFH0dLoreXej1ivSSz+cLaU4BPqHjw8x5kFk8YSELCxkMSGU3VQaUEfzV wR5Q00NNtw8Cbgeg0FE8OrbYmlQg7WmEIOjVxKyNgA9oxaLKII2sollOd17rvddd5C613AHcmNpve EOIRwBCTw==; Received: from 213-225-15-246.nat.highway.a1.net ([213.225.15.246] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGJrT-0001zp-TQ; Wed, 09 May 2018 07:50:08 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 25/33] xfs: move all writeback buffer_head manipulation into xfs_map_at_offset Date: Wed, 9 May 2018 09:48:22 +0200 Message-Id: <20180509074830.16196-26-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509074830.16196-1-hch@lst.de> References: <20180509074830.16196-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 f6d28e6aa911..c76c943473be 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++; }