The patch titled Subject: fs: use pagevec_lookup_range() in page_cache_seek_hole_data() has been added to the -mm tree. Its filename is fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jan Kara <jack@xxxxxxx> Subject: fs: use pagevec_lookup_range() in page_cache_seek_hole_data() We want only pages from given range in page_cache_seek_hole_data(). Use pagevec_lookup_range() instead of pagevec_lookup() and remove unnecessary code. Note that the check for getting less pages than desired can be removed because index gets updated by pagevec_lookup_range(). Link: http://lkml.kernel.org/r/20170726114704.7626-9-jack@xxxxxxx Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/buffer.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff -puN fs/buffer.c~fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data fs/buffer.c --- a/fs/buffer.c~fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data +++ a/fs/buffer.c @@ -3549,11 +3549,10 @@ page_cache_seek_hole_data(struct inode * pagevec_init(&pvec, 0); do { - unsigned want, nr_pages, i; + unsigned nr_pages, i; - want = min_t(unsigned, end - index, PAGEVEC_SIZE); - nr_pages = pagevec_lookup(&pvec, inode->i_mapping, &index, - want); + nr_pages = pagevec_lookup_range(&pvec, inode->i_mapping, &index, + end - 1, PAGEVEC_SIZE); if (nr_pages == 0) break; @@ -3574,10 +3573,6 @@ page_cache_seek_hole_data(struct inode * lastoff < page_offset(page)) goto check_range; - /* Searching done if the page index is out of range. */ - if (page->index >= end) - goto not_found; - lock_page(page); if (likely(page->mapping == inode->i_mapping) && page_has_buffers(page)) { @@ -3590,11 +3585,6 @@ page_cache_seek_hole_data(struct inode * unlock_page(page); lastoff = page_offset(page) + PAGE_SIZE; } - - /* Searching done if fewer pages returned than wanted. */ - if (nr_pages < want) - break; - pagevec_release(&pvec); } while (index < end); _ Patches currently in -mm which might be from jack@xxxxxxx are fscache-remove-unused-now_uncached-callback.patch mm-make-pagevec_lookup-update-index.patch mm-implement-find_get_pages_range.patch fs-fix-performance-regression-in-clean_bdev_aliases.patch ext4-use-pagevec_lookup_range-in-ext4_find_unwritten_pgoff.patch ext4-use-pagevec_lookup_range-in-writeback-code.patch hugetlbfs-use-pagevec_lookup_range-in-remove_inode_hugepages.patch fs-use-pagevec_lookup_range-in-page_cache_seek_hole_data.patch mm-use-find_get_pages_range-in-filemap_range_has_page.patch mm-remove-nr_pages-argument-from-pagevec_lookup_range.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html