Lines Matching refs:page

163 void release_pages(struct page **pages, int nr);
168 static inline struct address_space *page_mapping_file(struct page *page) in page_mapping_file() argument
170 if (unlikely(PageSwapCache(page))) in page_mapping_file()
172 return page_mapping(page); in page_mapping_file()
219 static inline int __page_cache_add_speculative(struct page *page, int count) in __page_cache_add_speculative() argument
234 VM_BUG_ON_PAGE(page_count(page) == 0, page); in __page_cache_add_speculative()
235 page_ref_add(page, count); in __page_cache_add_speculative()
238 if (unlikely(!page_ref_add_unless(page, count, 0))) { in __page_cache_add_speculative()
247 VM_BUG_ON_PAGE(PageTail(page), page); in __page_cache_add_speculative()
252 static inline int page_cache_get_speculative(struct page *page) in page_cache_get_speculative() argument
254 return __page_cache_add_speculative(page, 1); in page_cache_get_speculative()
257 static inline int page_cache_add_speculative(struct page *page, int count) in page_cache_add_speculative() argument
259 return __page_cache_add_speculative(page, count); in page_cache_add_speculative()
270 static inline void attach_page_private(struct page *page, void *data) in attach_page_private() argument
272 get_page(page); in attach_page_private()
273 set_page_private(page, (unsigned long)data); in attach_page_private()
274 SetPagePrivate(page); in attach_page_private()
286 static inline void *detach_page_private(struct page *page) in detach_page_private() argument
288 void *data = (void *)page_private(page); in detach_page_private()
290 if (!PagePrivate(page)) in detach_page_private()
292 ClearPagePrivate(page); in detach_page_private()
293 set_page_private(page, 0); in detach_page_private()
294 put_page(page); in detach_page_private()
300 extern struct page *__page_cache_alloc(gfp_t gfp);
302 static inline struct page *__page_cache_alloc(gfp_t gfp) in __page_cache_alloc()
308 static inline struct page *page_cache_alloc(struct address_space *x) in page_cache_alloc()
318 typedef int filler_t(void *, struct page *);
335 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
348 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page()
354 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags()
373 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page()
392 static inline struct page *find_lock_head(struct address_space *mapping, in find_lock_head()
417 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page()
438 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait()
447 static inline bool thp_contains(struct page *head, pgoff_t index) in thp_contains()
459 static inline struct page *find_subpage(struct page *head, pgoff_t index) in find_subpage()
472 struct page **pages);
475 struct page **pages) in find_get_pages()
481 unsigned int nr_pages, struct page **pages);
484 struct page **pages);
487 struct page **pages) in find_get_pages_tag()
493 struct page *grab_cache_page_write_begin(struct address_space *mapping,
499 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page()
505 extern struct page * read_cache_page(struct address_space *mapping,
507 extern struct page * read_cache_page_gfp(struct address_space *mapping,
512 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page()
522 static inline pgoff_t page_to_index(struct page *page) in page_to_index() argument
524 struct page *head; in page_to_index()
526 if (likely(!PageTransTail(page))) in page_to_index()
527 return page->index; in page_to_index()
529 head = compound_head(page); in page_to_index()
534 return head->index + page - head; in page_to_index()
537 extern pgoff_t hugetlb_basepage_index(struct page *page);
543 static inline pgoff_t page_to_pgoff(struct page *page) in page_to_pgoff() argument
545 if (unlikely(PageHuge(page))) in page_to_pgoff()
546 return hugetlb_basepage_index(page); in page_to_pgoff()
547 return page_to_index(page); in page_to_pgoff()
553 static inline loff_t page_offset(struct page *page) in page_offset() argument
555 return ((loff_t)page->index) << PAGE_SHIFT; in page_offset()
558 static inline loff_t page_file_offset(struct page *page) in page_file_offset() argument
560 return ((loff_t)page_index(page)) << PAGE_SHIFT; in page_file_offset()
578 struct page *page; member
584 struct page *page; member
592 if (wait_page->page != key->page) in wake_page_match()
602 extern void __lock_page(struct page *page);
603 extern int __lock_page_killable(struct page *page);
604 extern int __lock_page_async(struct page *page, struct wait_page_queue *wait);
605 extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
607 extern void unlock_page(struct page *page);
612 static inline int trylock_page(struct page *page) in trylock_page() argument
614 page = compound_head(page); in trylock_page()
615 return (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); in trylock_page()
621 static inline void lock_page(struct page *page) in lock_page() argument
624 if (!trylock_page(page)) in lock_page()
625 __lock_page(page); in lock_page()
633 static inline int lock_page_killable(struct page *page) in lock_page_killable() argument
636 if (!trylock_page(page)) in lock_page_killable()
637 return __lock_page_killable(page); in lock_page_killable()
649 static inline int lock_page_async(struct page *page, in lock_page_async() argument
652 if (!trylock_page(page)) in lock_page_async()
653 return __lock_page_async(page, wait); in lock_page_async()
664 static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, in lock_page_or_retry() argument
668 return trylock_page(page) || __lock_page_or_retry(page, mm, flags); in lock_page_or_retry()
675 extern void wait_on_page_bit(struct page *page, int bit_nr);
676 extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
685 static inline void wait_on_page_locked(struct page *page) in wait_on_page_locked() argument
687 if (PageLocked(page)) in wait_on_page_locked()
688 wait_on_page_bit(compound_head(page), PG_locked); in wait_on_page_locked()
691 static inline int wait_on_page_locked_killable(struct page *page) in wait_on_page_locked_killable() argument
693 if (!PageLocked(page)) in wait_on_page_locked_killable()
695 return wait_on_page_bit_killable(compound_head(page), PG_locked); in wait_on_page_locked_killable()
698 int put_and_wait_on_page_locked(struct page *page, int state);
699 void wait_on_page_writeback(struct page *page);
700 int wait_on_page_writeback_killable(struct page *page);
701 extern void end_page_writeback(struct page *page);
702 void wait_for_stable_page(struct page *page);
704 void __set_page_dirty(struct page *, struct address_space *, int warn);
705 int __set_page_dirty_nobuffers(struct page *page);
706 int __set_page_dirty_no_writeback(struct page *page);
708 void page_endio(struct page *page, bool is_write, int err);
719 static inline void set_page_private_2(struct page *page) in set_page_private_2() argument
721 page = compound_head(page); in set_page_private_2()
722 get_page(page); in set_page_private_2()
723 SetPagePrivate2(page); in set_page_private_2()
726 void end_page_private_2(struct page *page);
727 void wait_on_page_private_2(struct page *page);
728 int wait_on_page_private_2_killable(struct page *page);
733 extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter);
792 int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
794 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
796 extern void delete_from_page_cache(struct page *page);
797 extern void __delete_from_page_cache(struct page *page, void *shadow);
798 void replace_page_cache_page(struct page *old, struct page *new);
808 static inline int add_to_page_cache(struct page *page, in add_to_page_cache() argument
813 __SetPageLocked(page); in add_to_page_cache()
814 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); in add_to_page_cache()
816 __ClearPageLocked(page); in add_to_page_cache()
859 void page_cache_async_ra(struct readahead_control *, struct page *,
903 struct page *page, pgoff_t index, unsigned long req_count) in page_cache_async_readahead() argument
906 page_cache_async_ra(&ractl, page, req_count); in page_cache_async_readahead()
918 static inline struct page *readahead_page(struct readahead_control *rac) in readahead_page()
920 struct page *page; in readahead_page() local
931 page = xa_load(&rac->mapping->i_pages, rac->_index); in readahead_page()
932 VM_BUG_ON_PAGE(!PageLocked(page), page); in readahead_page()
933 rac->_batch_count = thp_nr_pages(page); in readahead_page()
935 return page; in readahead_page()
939 struct page **array, unsigned int array_sz) in __readahead_batch()
943 struct page *page; in __readahead_batch() local
952 xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { in __readahead_batch()
953 if (xas_retry(&xas, page)) in __readahead_batch()
955 VM_BUG_ON_PAGE(!PageLocked(page), page); in __readahead_batch()
956 VM_BUG_ON_PAGE(PageTail(page), page); in __readahead_batch()
957 array[i++] = page; in __readahead_batch()
958 rac->_batch_count += thp_nr_pages(page); in __readahead_batch()
966 if (PageHead(page)) in __readahead_batch()
1050 static inline int page_mkwrite_check_truncate(struct page *page, in page_mkwrite_check_truncate() argument
1057 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()
1061 if (page->index < index) in page_mkwrite_check_truncate()
1064 if (page->index > index || !offset) in page_mkwrite_check_truncate()
1082 unsigned int i_blocks_per_page(struct inode *inode, struct page *page) in i_blocks_per_page() argument
1084 return thp_size(page) >> inode->i_blkbits; in i_blocks_per_page()