diff options
author | Jan Kara <jack@suse.cz> | 2017-11-15 20:35:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 21:21:04 -0500 |
commit | 2b9775ae422fa46b4aee2bb2a8d2184a5a3b90e0 (patch) | |
tree | c9ddb86cd863d381b72594fbbce2e693c2b780bc /mm/page-writeback.c | |
parent | 312e9d2f7053f480627dcaf5e14f9cae78e3715a (diff) |
mm: use pagevec_lookup_range_tag() in write_cache_pages()
Use pagevec_lookup_range_tag() in write_cache_pages() as it is
interested only in pages from given range. Remove unnecessary code
resulting from this.
Link: http://lkml.kernel.org/r/20171009151359.31984-12-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r-- | mm/page-writeback.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 768fe4e37e6a..460fc022cbc8 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -2196,30 +2196,14 @@ retry: | |||
2196 | while (!done && (index <= end)) { | 2196 | while (!done && (index <= end)) { |
2197 | int i; | 2197 | int i; |
2198 | 2198 | ||
2199 | nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag, | 2199 | nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, |
2200 | min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1); | 2200 | tag, PAGEVEC_SIZE); |
2201 | if (nr_pages == 0) | 2201 | if (nr_pages == 0) |
2202 | break; | 2202 | break; |
2203 | 2203 | ||
2204 | for (i = 0; i < nr_pages; i++) { | 2204 | for (i = 0; i < nr_pages; i++) { |
2205 | struct page *page = pvec.pages[i]; | 2205 | struct page *page = pvec.pages[i]; |
2206 | 2206 | ||
2207 | /* | ||
2208 | * At this point, the page may be truncated or | ||
2209 | * invalidated (changing page->mapping to NULL), or | ||
2210 | * even swizzled back from swapper_space to tmpfs file | ||
2211 | * mapping. However, page->index will not change | ||
2212 | * because we have a reference on the page. | ||
2213 | */ | ||
2214 | if (page->index > end) { | ||
2215 | /* | ||
2216 | * can't be range_cyclic (1st pass) because | ||
2217 | * end == -1 in that case. | ||
2218 | */ | ||
2219 | done = 1; | ||
2220 | break; | ||
2221 | } | ||
2222 | |||
2223 | done_index = page->index; | 2207 | done_index = page->index; |
2224 | 2208 | ||
2225 | lock_page(page); | 2209 | lock_page(page); |