diff options
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r-- | include/linux/pagemap.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 3c62ed408492..e12cdc6d79ee 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/gfp.h> | 13 | #include <linux/gfp.h> |
14 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
15 | #include <linux/hardirq.h> /* for in_interrupt() */ | 15 | #include <linux/hardirq.h> /* for in_interrupt() */ |
16 | #include <linux/hugetlb_inline.h> | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page | 19 | * 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) | |||
281 | return ((loff_t)page->index) << PAGE_CACHE_SHIFT; | 282 | return ((loff_t)page->index) << PAGE_CACHE_SHIFT; |
282 | } | 283 | } |
283 | 284 | ||
285 | extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma, | ||
286 | unsigned long address); | ||
287 | |||
284 | static inline pgoff_t linear_page_index(struct vm_area_struct *vma, | 288 | static inline pgoff_t linear_page_index(struct vm_area_struct *vma, |
285 | unsigned long address) | 289 | unsigned long address) |
286 | { | 290 | { |
287 | pgoff_t pgoff = (address - vma->vm_start) >> PAGE_SHIFT; | 291 | pgoff_t pgoff; |
292 | if (unlikely(is_vm_hugetlb_page(vma))) | ||
293 | return linear_hugepage_index(vma, address); | ||
294 | pgoff = (address - vma->vm_start) >> PAGE_SHIFT; | ||
288 | pgoff += vma->vm_pgoff; | 295 | pgoff += vma->vm_pgoff; |
289 | return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); | 296 | return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); |
290 | } | 297 | } |
@@ -423,8 +430,10 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size) | |||
423 | const char __user *end = uaddr + size - 1; | 430 | const char __user *end = uaddr + size - 1; |
424 | 431 | ||
425 | if (((unsigned long)uaddr & PAGE_MASK) != | 432 | if (((unsigned long)uaddr & PAGE_MASK) != |
426 | ((unsigned long)end & PAGE_MASK)) | 433 | ((unsigned long)end & PAGE_MASK)) { |
427 | ret = __get_user(c, end); | 434 | ret = __get_user(c, end); |
435 | (void)c; | ||
436 | } | ||
428 | } | 437 | } |
429 | return ret; | 438 | return ret; |
430 | } | 439 | } |