Commit f7b68046 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

mm: use find_get_pages_range() in filemap_range_has_page()

We want only pages from given range in filemap_range_has_page(),
furthermore we want at most a single page.

So use find_get_pages_range() instead of pagevec_lookup() and remove
unnecessary code.

Link: default avatarJan Kara <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 8338141f
......@@ -393,8 +393,7 @@ bool filemap_range_has_page(struct address_space *mapping,
pgoff_t index = start_byte >> PAGE_SHIFT;
pgoff_t end = end_byte >> PAGE_SHIFT;
struct pagevec pvec;
bool ret;
struct page *page;
if (end_byte < start_byte)
return false;
......@@ -402,12 +401,10 @@ bool filemap_range_has_page(struct address_space *mapping,
if (mapping->nrpages == 0)
return false;
pagevec_init(&pvec, 0);
if (!pagevec_lookup(&pvec, mapping, &index, 1))
if (!find_get_pages_range(mapping, &index, end, 1, &page))
return false;
ret = (pvec.pages[0]->index <= end);
return ret;
return true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment