summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-09-07 02:21:40 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 03:27:27 +0300
commitf7b68046873724129798c405e1a4e326b409c08f (patch)
tree10e685a34f8bb0a0603b04a417c72b20c398efeb
parent8338141f0f51325de5fd096e4179d01dac6f3655 (diff)
downloadlinux-f7b68046873724129798c405e1a4e326b409c08f.tar.xz
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: http://lkml.kernel.org/r/20170726114704.7626-10-jack@suse.cz Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/filemap.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 129883f160a7..84617a05db50 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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);
- pagevec_release(&pvec);
- return ret;
+ put_page(page);
+ return true;
}
EXPORT_SYMBOL(filemap_range_has_page);