]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/pagemap.h
mm: fix false-positive WARN_ON() in truncate/invalidate for hugetlb
[mirror_ubuntu-artful-kernel.git] / include / linux / pagemap.h
index dd15d39e1985908614271dcb8e8712c4fffa4f63..7dbe9148b2f8a661257d0aa620cf1f61fa7d5f57 100644 (file)
@@ -374,16 +374,13 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
 }
 
 /*
- * Get the offset in PAGE_SIZE.
- * (TODO: hugepage should have ->index in PAGE_SIZE)
+ * Get index of the page with in radix-tree
+ * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE)
  */
-static inline pgoff_t page_to_pgoff(struct page *page)
+static inline pgoff_t page_to_index(struct page *page)
 {
        pgoff_t pgoff;
 
-       if (unlikely(PageHeadHuge(page)))
-               return page->index << compound_order(page);
-
        if (likely(!PageTransTail(page)))
                return page->index;
 
@@ -396,6 +393,18 @@ static inline pgoff_t page_to_pgoff(struct page *page)
        return pgoff;
 }
 
+/*
+ * Get the offset in PAGE_SIZE.
+ * (TODO: hugepage should have ->index in PAGE_SIZE)
+ */
+static inline pgoff_t page_to_pgoff(struct page *page)
+{
+       if (unlikely(PageHeadHuge(page)))
+               return page->index << compound_order(page);
+
+       return page_to_index(page);
+}
+
 /*
  * Return byte-offset into filesystem object for page.
  */