diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7c6dfd2faa69..7cdac1676b59 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -805,6 +805,17 @@ static inline void *page_rmapping(struct page *page) | |||
805 | return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); | 805 | return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); |
806 | } | 806 | } |
807 | 807 | ||
808 | extern struct address_space *__page_file_mapping(struct page *); | ||
809 | |||
810 | static inline | ||
811 | struct address_space *page_file_mapping(struct page *page) | ||
812 | { | ||
813 | if (unlikely(PageSwapCache(page))) | ||
814 | return __page_file_mapping(page); | ||
815 | |||
816 | return page->mapping; | ||
817 | } | ||
818 | |||
808 | static inline int PageAnon(struct page *page) | 819 | static inline int PageAnon(struct page *page) |
809 | { | 820 | { |
810 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; | 821 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; |
@@ -821,6 +832,20 @@ static inline pgoff_t page_index(struct page *page) | |||
821 | return page->index; | 832 | return page->index; |
822 | } | 833 | } |
823 | 834 | ||
835 | extern pgoff_t __page_file_index(struct page *page); | ||
836 | |||
837 | /* | ||
838 | * Return the file index of the page. Regular pagecache pages use ->index | ||
839 | * whereas swapcache pages use swp_offset(->private) | ||
840 | */ | ||
841 | static inline pgoff_t page_file_index(struct page *page) | ||
842 | { | ||
843 | if (unlikely(PageSwapCache(page))) | ||
844 | return __page_file_index(page); | ||
845 | |||
846 | return page->index; | ||
847 | } | ||
848 | |||
824 | /* | 849 | /* |
825 | * Return true if this page is mapped into pagetables. | 850 | * Return true if this page is mapped into pagetables. |
826 | */ | 851 | */ |