From patchwork Fri Jun 15 13:02:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10466409 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 76C6260384 for ; Fri, 15 Jun 2018 13:03:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69C2628BBE for ; Fri, 15 Jun 2018 13:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EE2328D67; Fri, 15 Jun 2018 13:03:12 +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 099DB28D04 for ; Fri, 15 Jun 2018 13:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965593AbeFONDJ (ORCPT ); Fri, 15 Jun 2018 09:03:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37418 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936262AbeFONDH (ORCPT ); Fri, 15 Jun 2018 09:03:07 -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=4jZY0+nrOzKbrhQ+FW2vRTZK4GVnWZ5bDLEOp1FQ0pI=; b=HaFVTKz2ur15sDHDF02Q6hHND pvy9b9/QIlQk0UuYvDXB5eo5199/YvaQtfHPoADRPQyj9V39rMuBi1OvY8W11eEjT9h42tVHDE7Lq KkIbbTby6K3bRBdS7dbEDJTk0ngMDw0i/D6xzwd03vEotsXlXMFmcJglBnanea4WfiOWDIM+4I0zp R2sKuIpfPJpR0Y7aTsA92C64DFCuDhmh5gMChNe/iQZMcfX8RukvzALseAaUyzbX2kYJ03OhMQHJj 1yJJnvvZbp5XaEDaEk/JX9UZ79MtpIl57VIdJIQn5OzUdQ8EPK5ryEamv4c2kT6+YCqyfIFrTKAAw 8I2e+Okmw==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fToNd-0003gj-V1; Fri, 15 Jun 2018 13:03:06 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 19/24] xfs: move all writeback buffer_head manipulation into xfs_map_at_offset Date: Fri, 15 Jun 2018 15:02:04 +0200 Message-Id: <20180615130209.1970-20-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615130209.1970-1-hch@lst.de> References: <20180615130209.1970-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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- 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 d6bd38d4243e..261fb011ef9d 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -500,21 +500,6 @@ xfs_map_blocks( return 0; } -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, @@ -723,6 +708,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); @@ -735,6 +721,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 @@ -858,11 +848,9 @@ xfs_writepage_map( if (wpc->io_type == XFS_IO_HOLE) 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++; }