mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
btrfs: use pagevec_lookup_range_tag()
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/20171009151359.31984-3-jack@suse.cz Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: David Sterba <dsterba@suse.com> Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com> Cc: David Sterba <dsterba@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bf9510b162
commit
e25fadabb5
|
|
@ -3932,8 +3932,8 @@ int btree_write_cache_pages(struct address_space *mapping,
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL)
|
if (wbc->sync_mode == WB_SYNC_ALL)
|
||||||
tag_pages_for_writeback(mapping, index, end);
|
tag_pages_for_writeback(mapping, index, end);
|
||||||
while (!done && !nr_to_write_done && (index <= end) &&
|
while (!done && !nr_to_write_done && (index <= end) &&
|
||||||
(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
|
(nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
|
||||||
min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
|
tag, PAGEVEC_SIZE))) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
scanned = 1;
|
scanned = 1;
|
||||||
|
|
@ -3943,11 +3943,6 @@ int btree_write_cache_pages(struct address_space *mapping,
|
||||||
if (!PagePrivate(page))
|
if (!PagePrivate(page))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!wbc->range_cyclic && page->index > end) {
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock(&mapping->private_lock);
|
spin_lock(&mapping->private_lock);
|
||||||
if (!PagePrivate(page)) {
|
if (!PagePrivate(page)) {
|
||||||
spin_unlock(&mapping->private_lock);
|
spin_unlock(&mapping->private_lock);
|
||||||
|
|
@ -4076,8 +4071,8 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL)
|
if (wbc->sync_mode == WB_SYNC_ALL)
|
||||||
tag_pages_for_writeback(mapping, index, end);
|
tag_pages_for_writeback(mapping, index, end);
|
||||||
while (!done && !nr_to_write_done && (index <= end) &&
|
while (!done && !nr_to_write_done && (index <= end) &&
|
||||||
(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
|
(nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
|
||||||
min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
|
tag, PAGEVEC_SIZE))) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
scanned = 1;
|
scanned = 1;
|
||||||
|
|
@ -4101,12 +4096,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wbc->range_cyclic && page->index > end) {
|
|
||||||
done = 1;
|
|
||||||
unlock_page(page);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wbc->sync_mode != WB_SYNC_NONE) {
|
if (wbc->sync_mode != WB_SYNC_NONE) {
|
||||||
if (PageWriteback(page))
|
if (PageWriteback(page))
|
||||||
flush_fn(data);
|
flush_fn(data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user