summaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2021-02-25 17:15:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-02-26 09:40:59 -0800
commit5c211ba29deb84e647b3a87207c8714efd9c11d5 (patch)
treefeef0b45d73033f62cf5c6f0f3c26a26008c8cec /mm/internal.h
parent54fa39ac2e00b1b8c2a7fe72e648773ffa48f76d (diff)
downloadlinux-5c211ba29deb84e647b3a87207c8714efd9c11d5.tar.gz
linux-5c211ba29deb84e647b3a87207c8714efd9c11d5.tar.bz2
linux-5c211ba29deb84e647b3a87207c8714efd9c11d5.zip
mm: add and use find_lock_entries
We have three functions (shmem_undo_range(), truncate_inode_pages_range() and invalidate_mapping_pages()) which want exactly this function, so add it to filemap.c. Before this patch, shmem_undo_range() would split any compound page which overlaps either end of the range being punched in both the first and second loops through the address space. After this patch, that functionality is left for the second loop, which is arguably more appropriate since the first loop is supposed to run through all the pages quickly, and splitting a page can sleep. [willy@infradead.org: add assertion] Link: https://lkml.kernel.org/r/20201124041507.28996-3-willy@infradead.org Link: https://lkml.kernel.org/r/20201112212641.27837-10-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Dave Chinner <dchinner@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Yang Shi <yang.shi@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/internal.h b/mm/internal.h
index eed74f1e6147..9902648f2206 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -60,6 +60,9 @@ static inline void force_page_cache_readahead(struct address_space *mapping,
force_page_cache_ra(&ractl, &file->f_ra, nr_to_read);
}
+unsigned find_lock_entries(struct address_space *mapping, pgoff_t start,
+ pgoff_t end, struct pagevec *pvec, pgoff_t *indices);
+
/**
* page_evictable - test whether a page is evictable
* @page: the page to test