diff options
Diffstat (limited to 'include/linux/pagemap.h')
| -rw-r--r-- | include/linux/pagemap.h | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0a97b583ee8d..3df8c7db7a4e 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -399,6 +399,18 @@ 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) + */ +static inline pgoff_t page_to_pgoff(struct page *page) +{ +	if (unlikely(PageHeadHuge(page))) +		return page->index << compound_order(page); +	else +		return page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); +} + +/*   * Return byte-offset into filesystem object for page.   */  static inline loff_t page_offset(struct page *page) @@ -472,6 +484,9 @@ static inline int lock_page_killable(struct page *page)  /*   * lock_page_or_retry - Lock the page, unless this would block and the   * caller indicated that it can handle a retry. + * + * Return value and mmap_sem implications depend on flags; see + * __lock_page_or_retry().   */  static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,  				     unsigned int flags) | 
