mm: use find_get_pages_range() in filemap_range_has_page()
[sfrench/cifs-2.6.git] / mm / filemap.c
index 129883f160a7ba12e4b327dcf07a58bab4af0ce1..84617a05db50b31d4dfe4bc0bbc1b094793e4a39 100644 (file)
@@ -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);