Skip to content

Commit

Permalink
btrfs: use pagevec_lookup_range_tag()
Browse files Browse the repository at this point in the history
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.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Cc: David Sterba <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jankara authored and torvalds committed Nov 16, 2017
1 parent 72b045a commit 4006f43
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3814,8 +3814,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;
Expand All @@ -3825,11 +3825,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);
Expand Down Expand Up @@ -3961,8 +3956,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;
Expand All @@ -3987,12 +3982,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);
Expand Down

0 comments on commit 4006f43

Please sign in to comment.