From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Jan Kara To: Andrew Morton Cc: , , Daniel Jordan , Jan Kara , linux-btrfs@vger.kernel.org, David Sterba Subject: [PATCH 02/16] btrfs: Use pagevec_lookup_range_tag() Date: Mon, 9 Oct 2017 17:13:45 +0200 Message-Id: <20171009151359.31984-3-jack@suse.cz> In-Reply-To: <20171009151359.31984-1-jack@suse.cz> References: <20171009151359.31984-1-jack@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: We want only pages from given range in btree_write_cache_pages() and extent_write_cache_pages(). Use pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove unnecessary code. CC: linux-btrfs@vger.kernel.org CC: David Sterba Reviewed-by: David Sterba Reviewed-by: Daniel Jordan Signed-off-by: Jan Kara --- fs/btrfs/extent_io.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 970190cd347e..a4eb6c988f27 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3818,8 +3818,8 @@ int btree_write_cache_pages(struct address_space *mapping, if (wbc->sync_mode == WB_SYNC_ALL) tag_pages_for_writeback(mapping, index, end); while (!done && !nr_to_write_done && (index <= end) && - (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag, - min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { + (nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, + tag, PAGEVEC_SIZE))) { unsigned i; scanned = 1; @@ -3829,11 +3829,6 @@ int btree_write_cache_pages(struct address_space *mapping, if (!PagePrivate(page)) continue; - if (!wbc->range_cyclic && page->index > end) { - done = 1; - break; - } - spin_lock(&mapping->private_lock); if (!PagePrivate(page)) { spin_unlock(&mapping->private_lock); @@ -3965,8 +3960,8 @@ static int extent_write_cache_pages(struct address_space *mapping, tag_pages_for_writeback(mapping, index, end); done_index = index; while (!done && !nr_to_write_done && (index <= end) && - (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag, - min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { + (nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, + tag, PAGEVEC_SIZE))) { unsigned i; scanned = 1; @@ -3991,12 +3986,6 @@ static int extent_write_cache_pages(struct address_space *mapping, continue; } - if (!wbc->range_cyclic && page->index > end) { - done = 1; - unlock_page(page); - continue; - } - if (wbc->sync_mode != WB_SYNC_NONE) { if (PageWriteback(page)) flush_fn(data); -- 2.12.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org