mm/shmem: return head page from find_lock_entry
[linux-2.6-microblaze.git] / include / linux / pagemap.h
index 9d282fe..5176009 100644 (file)
@@ -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