aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pagemap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r--include/linux/pagemap.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index dd15d39e1985..7dbe9148b2f8 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -374,16 +374,13 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
374} 374}
375 375
376/* 376/*
377 * Get the offset in PAGE_SIZE. 377 * Get index of the page with in radix-tree
378 * (TODO: hugepage should have ->index in PAGE_SIZE) 378 * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE)
379 */ 379 */
380static inline pgoff_t page_to_pgoff(struct page *page) 380static inline pgoff_t page_to_index(struct page *page)
381{ 381{
382 pgoff_t pgoff; 382 pgoff_t pgoff;
383 383
384 if (unlikely(PageHeadHuge(page)))
385 return page->index << compound_order(page);
386
387 if (likely(!PageTransTail(page))) 384 if (likely(!PageTransTail(page)))
388 return page->index; 385 return page->index;
389 386
@@ -397,6 +394,18 @@ static inline pgoff_t page_to_pgoff(struct page *page)
397} 394}
398 395
399/* 396/*
397 * Get the offset in PAGE_SIZE.
398 * (TODO: hugepage should have ->index in PAGE_SIZE)
399 */
400static inline pgoff_t page_to_pgoff(struct page *page)
401{
402 if (unlikely(PageHeadHuge(page)))
403 return page->index << compound_order(page);
404
405 return page_to_index(page);
406}
407
408/*
400 * Return byte-offset into filesystem object for page. 409 * Return byte-offset into filesystem object for page.
401 */ 410 */
402static inline loff_t page_offset(struct page *page) 411static inline loff_t page_offset(struct page *page)