diff options
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r-- | include/linux/pagemap.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 78a702ce4fcb..e12cdc6d79ee 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -13,6 +13,7 @@ #include <linux/gfp.h> #include <linux/bitops.h> #include <linux/hardirq.h> /* for in_interrupt() */ +#include <linux/hugetlb_inline.h> /* * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page @@ -281,10 +282,16 @@ static inline loff_t page_offset(struct page *page) return ((loff_t)page->index) << PAGE_CACHE_SHIFT; } +extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma, + unsigned long address); + static inline pgoff_t linear_page_index(struct vm_area_struct *vma, unsigned long address) { - pgoff_t pgoff = (address - vma->vm_start) >> PAGE_SHIFT; + pgoff_t pgoff; + if (unlikely(is_vm_hugetlb_page(vma))) + return linear_hugepage_index(vma, address); + pgoff = (address - vma->vm_start) >> PAGE_SHIFT; pgoff += vma->vm_pgoff; return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); } |