This started out as part of the THP patchset, but it's turned into a nice simplification in its own right. Essentially we end up unifying find_get_entries() and pagevec_lookup_entries() into one function that's better than either, and we get rid of a lot of code in the callers as a result. I'm running this through xfstests right now, but something similar to this has already passed xfstests as part of the THP patchset. I've done my best to avoid off-by-one errors for 'end', but I wouldn't be surprised if I made a mistake. We're not consistent with whether 'end' is inclusive or exclusive and I didn't want to make extensive changes to ensure they were consistent. Matthew Wilcox (Oracle) (7): mm: Use pagevec_lookup in shmem_unlock_mapping mm: Rewrite shmem_seek_hole_data mm: Add an 'end' parameter to find_get_entries mm: Add an 'end' parameter to pagevec_lookup_entries mm: Remove nr_entries parameter from pagevec_lookup_entries mm: Pass pvec directly to find_get_entries mm: Remove pagevec_lookup_entries include/linux/pagemap.h | 3 +- include/linux/pagevec.h | 4 -- mm/filemap.c | 19 +++++---- mm/shmem.c | 85 ++++++++++++++--------------------------- mm/swap.c | 38 +----------------- mm/truncate.c | 33 +++------------- 6 files changed, 45 insertions(+), 137 deletions(-) -- 2.28.0