From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:51268 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932756AbeEaSJA (ORCPT ); Thu, 31 May 2018 14:09:00 -0400 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 18/21] xfs: move all writeback buffer_head manipulation into xfs_map_at_offset Date: Thu, 31 May 2018 20:07:56 +0200 Message-Id: <20180531180759.21631-19-hch@lst.de> In-Reply-To: <20180531180759.21631-1-hch@lst.de> References: <20180531180759.21631-1-hch@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 5950a3627c00..8328f55b7ea7 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -499,21 +499,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, @@ -722,6 +707,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); @@ -734,6 +720,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 @@ -857,11 +847,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++; } -- 2.17.0