diff options
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r-- | include/linux/pagemap.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 9d282fe6700d..5176009e4ffa 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -372,6 +372,15 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, mapping_gfp_mask(mapping)); } +/* Does this page contain this index? */ +static inline bool thp_contains(struct page *head, pgoff_t index) +{ + /* HugeTLBfs indexes the page cache in units of hpage_size */ + if (PageHuge(head)) + return head->index == index; + return page_index(head) == (index & ~(thp_nr_pages(head) - 1UL)); +} + /* * Given the page we found in the page cache, return the page corresponding * to this index in the file |