Lines Matching refs:page
158 void release_pages(struct page **pages, int nr);
204 static inline int __page_cache_add_speculative(struct page *page, int count) in __page_cache_add_speculative() argument
219 VM_BUG_ON_PAGE(page_count(page) == 0, page); in __page_cache_add_speculative()
220 page_ref_add(page, count); in __page_cache_add_speculative()
223 if (unlikely(!page_ref_add_unless(page, count, 0))) { in __page_cache_add_speculative()
232 VM_BUG_ON_PAGE(PageTail(page), page); in __page_cache_add_speculative()
237 static inline int page_cache_get_speculative(struct page *page) in page_cache_get_speculative() argument
239 return __page_cache_add_speculative(page, 1); in page_cache_get_speculative()
242 static inline int page_cache_add_speculative(struct page *page, int count) in page_cache_add_speculative() argument
244 return __page_cache_add_speculative(page, count); in page_cache_add_speculative()
255 static inline void attach_page_private(struct page *page, void *data) in attach_page_private() argument
257 get_page(page); in attach_page_private()
258 set_page_private(page, (unsigned long)data); in attach_page_private()
259 SetPagePrivate(page); in attach_page_private()
271 static inline void *detach_page_private(struct page *page) in detach_page_private() argument
273 void *data = (void *)page_private(page); in detach_page_private()
275 if (!PagePrivate(page)) in detach_page_private()
277 ClearPagePrivate(page); in detach_page_private()
278 set_page_private(page, 0); in detach_page_private()
279 put_page(page); in detach_page_private()
285 extern struct page *__page_cache_alloc(gfp_t gfp);
287 static inline struct page *__page_cache_alloc(gfp_t gfp) in __page_cache_alloc()
293 static inline struct page *page_cache_alloc(struct address_space *x) in page_cache_alloc()
303 typedef int filler_t(void *, struct page *);
319 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
332 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page()
338 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags()
357 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page()
376 static inline struct page *find_lock_head(struct address_space *mapping, in find_lock_head()
401 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page()
422 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait()
431 static inline bool thp_contains(struct page *head, pgoff_t index) in thp_contains()
443 static inline struct page *find_subpage(struct page *head, pgoff_t index) in find_subpage()
453 unsigned int nr_entries, struct page **entries,
457 struct page **pages);
460 struct page **pages) in find_get_pages()
466 unsigned int nr_pages, struct page **pages);
469 struct page **pages);
472 struct page **pages) in find_get_pages_tag()
478 struct page *grab_cache_page_write_begin(struct address_space *mapping,
484 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page()
490 extern struct page * read_cache_page(struct address_space *mapping,
492 extern struct page * read_cache_page_gfp(struct address_space *mapping,
497 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page()
507 static inline pgoff_t page_to_index(struct page *page) in page_to_index() argument
511 if (likely(!PageTransTail(page))) in page_to_index()
512 return page->index; in page_to_index()
518 pgoff = compound_head(page)->index; in page_to_index()
519 pgoff += page - compound_head(page); in page_to_index()
527 static inline pgoff_t page_to_pgoff(struct page *page) in page_to_pgoff() argument
529 if (unlikely(PageHeadHuge(page))) in page_to_pgoff()
530 return page->index << compound_order(page); in page_to_pgoff()
532 return page_to_index(page); in page_to_pgoff()
538 static inline loff_t page_offset(struct page *page) in page_offset() argument
540 return ((loff_t)page->index) << PAGE_SHIFT; in page_offset()
543 static inline loff_t page_file_offset(struct page *page) in page_file_offset() argument
545 return ((loff_t)page_index(page)) << PAGE_SHIFT; in page_file_offset()
564 struct page *page; member
570 struct page *page; member
578 if (wait_page->page != key->page) in wake_page_match()
588 extern void __lock_page(struct page *page);
589 extern int __lock_page_killable(struct page *page);
590 extern int __lock_page_async(struct page *page, struct wait_page_queue *wait);
591 extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
593 extern void unlock_page(struct page *page);
598 static inline int trylock_page(struct page *page) in trylock_page() argument
600 page = compound_head(page); in trylock_page()
601 return (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); in trylock_page()
607 static inline void lock_page(struct page *page) in lock_page() argument
610 if (!trylock_page(page)) in lock_page()
611 __lock_page(page); in lock_page()
619 static inline int lock_page_killable(struct page *page) in lock_page_killable() argument
622 if (!trylock_page(page)) in lock_page_killable()
623 return __lock_page_killable(page); in lock_page_killable()
635 static inline int lock_page_async(struct page *page, in lock_page_async() argument
638 if (!trylock_page(page)) in lock_page_async()
639 return __lock_page_async(page, wait); in lock_page_async()
650 static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, in lock_page_or_retry() argument
654 return trylock_page(page) || __lock_page_or_retry(page, mm, flags); in lock_page_or_retry()
661 extern void wait_on_page_bit(struct page *page, int bit_nr);
662 extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
671 static inline void wait_on_page_locked(struct page *page) in wait_on_page_locked() argument
673 if (PageLocked(page)) in wait_on_page_locked()
674 wait_on_page_bit(compound_head(page), PG_locked); in wait_on_page_locked()
677 static inline int wait_on_page_locked_killable(struct page *page) in wait_on_page_locked_killable() argument
679 if (!PageLocked(page)) in wait_on_page_locked_killable()
681 return wait_on_page_bit_killable(compound_head(page), PG_locked); in wait_on_page_locked_killable()
684 extern void put_and_wait_on_page_locked(struct page *page);
686 void wait_on_page_writeback(struct page *page);
687 extern void end_page_writeback(struct page *page);
688 void wait_for_stable_page(struct page *page);
690 void page_endio(struct page *page, bool is_write, int err);
695 extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter);
754 int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
756 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
758 extern void delete_from_page_cache(struct page *page);
759 extern void __delete_from_page_cache(struct page *page, void *shadow);
760 int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
768 static inline int add_to_page_cache(struct page *page, in add_to_page_cache() argument
773 __SetPageLocked(page); in add_to_page_cache()
774 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); in add_to_page_cache()
776 __ClearPageLocked(page); in add_to_page_cache()
818 struct page *, unsigned long req_count);
859 struct page *page, pgoff_t index, unsigned long req_count) in page_cache_async_readahead() argument
862 page_cache_async_ra(&ractl, ra, page, req_count); in page_cache_async_readahead()
874 static inline struct page *readahead_page(struct readahead_control *rac) in readahead_page()
876 struct page *page; in readahead_page() local
887 page = xa_load(&rac->mapping->i_pages, rac->_index); in readahead_page()
888 VM_BUG_ON_PAGE(!PageLocked(page), page); in readahead_page()
889 rac->_batch_count = thp_nr_pages(page); in readahead_page()
891 return page; in readahead_page()
895 struct page **array, unsigned int array_sz) in __readahead_batch()
899 struct page *page; in __readahead_batch() local
908 xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { in __readahead_batch()
909 if (xas_retry(&xas, page)) in __readahead_batch()
911 VM_BUG_ON_PAGE(!PageLocked(page), page); in __readahead_batch()
912 VM_BUG_ON_PAGE(PageTail(page), page); in __readahead_batch()
913 array[i++] = page; in __readahead_batch()
914 rac->_batch_count += thp_nr_pages(page); in __readahead_batch()
922 if (PageHead(page)) in __readahead_batch()
997 static inline int page_mkwrite_check_truncate(struct page *page, in page_mkwrite_check_truncate() argument
1004 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()
1008 if (page->index < index) in page_mkwrite_check_truncate()
1011 if (page->index > index || !offset) in page_mkwrite_check_truncate()
1029 unsigned int i_blocks_per_page(struct inode *inode, struct page *page) in i_blocks_per_page() argument
1031 return thp_size(page) >> inode->i_blkbits; in i_blocks_per_page()