Lines Matching refs:page

159 void release_pages(struct page **pages, int nr);
205 static inline int __page_cache_add_speculative(struct page *page, int count) in __page_cache_add_speculative() argument
220 VM_BUG_ON_PAGE(page_count(page) == 0, page); in __page_cache_add_speculative()
221 page_ref_add(page, count); in __page_cache_add_speculative()
224 if (unlikely(!page_ref_add_unless(page, count, 0))) { in __page_cache_add_speculative()
233 VM_BUG_ON_PAGE(PageTail(page), page); in __page_cache_add_speculative()
238 static inline int page_cache_get_speculative(struct page *page) in page_cache_get_speculative() argument
240 return __page_cache_add_speculative(page, 1); in page_cache_get_speculative()
243 static inline int page_cache_add_speculative(struct page *page, int count) in page_cache_add_speculative() argument
245 return __page_cache_add_speculative(page, count); in page_cache_add_speculative()
256 static inline void attach_page_private(struct page *page, void *data) in attach_page_private() argument
258 get_page(page); in attach_page_private()
259 set_page_private(page, (unsigned long)data); in attach_page_private()
260 SetPagePrivate(page); in attach_page_private()
272 static inline void *detach_page_private(struct page *page) in detach_page_private() argument
274 void *data = (void *)page_private(page); in detach_page_private()
276 if (!PagePrivate(page)) in detach_page_private()
278 ClearPagePrivate(page); in detach_page_private()
279 set_page_private(page, 0); in detach_page_private()
280 put_page(page); in detach_page_private()
286 extern struct page *__page_cache_alloc(gfp_t gfp);
288 static inline struct page *__page_cache_alloc(gfp_t gfp) in __page_cache_alloc()
294 static inline struct page *page_cache_alloc(struct address_space *x) in page_cache_alloc()
301 typedef int filler_t(void *, struct page *);
317 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
330 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page()
336 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags()
355 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page()
374 static inline struct page *find_lock_head(struct address_space *mapping, in find_lock_head()
399 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page()
420 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait()
429 static inline bool thp_contains(struct page *head, pgoff_t index) in thp_contains()
441 static inline struct page *find_subpage(struct page *head, pgoff_t index) in find_subpage()
451 unsigned int nr_entries, struct page **entries,
455 struct page **pages);
458 struct page **pages) in find_get_pages()
464 unsigned int nr_pages, struct page **pages);
467 struct page **pages);
470 struct page **pages) in find_get_pages_tag()
476 struct page *grab_cache_page_write_begin(struct address_space *mapping,
482 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page()
488 extern struct page * read_cache_page(struct address_space *mapping,
490 extern struct page * read_cache_page_gfp(struct address_space *mapping,
495 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page()
505 static inline pgoff_t page_to_index(struct page *page) in page_to_index() argument
509 if (likely(!PageTransTail(page))) in page_to_index()
510 return page->index; in page_to_index()
516 pgoff = compound_head(page)->index; in page_to_index()
517 pgoff += page - compound_head(page); in page_to_index()
521 extern pgoff_t hugetlb_basepage_index(struct page *page);
527 static inline pgoff_t page_to_pgoff(struct page *page) in page_to_pgoff() argument
529 if (unlikely(PageHuge(page))) in page_to_pgoff()
530 return hugetlb_basepage_index(page); in page_to_pgoff()
531 return page_to_index(page); in page_to_pgoff()
537 static inline loff_t page_offset(struct page *page) in page_offset() argument
539 return ((loff_t)page->index) << PAGE_SHIFT; in page_offset()
542 static inline loff_t page_file_offset(struct page *page) in page_file_offset() argument
544 return ((loff_t)page_index(page)) << PAGE_SHIFT; in page_file_offset()
562 struct page *page; member
568 struct page *page; member
576 if (wait_page->page != key->page) in wake_page_match()
586 extern void __lock_page(struct page *page);
587 extern int __lock_page_killable(struct page *page);
588 extern int __lock_page_async(struct page *page, struct wait_page_queue *wait);
589 extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
591 extern void unlock_page(struct page *page);
596 static inline int trylock_page(struct page *page) in trylock_page() argument
598 page = compound_head(page); in trylock_page()
599 return (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); in trylock_page()
605 static inline __sched void lock_page(struct page *page) in lock_page() argument
608 if (!trylock_page(page)) in lock_page()
609 __lock_page(page); in lock_page()
617 static inline __sched int lock_page_killable(struct page *page) in lock_page_killable() argument
620 if (!trylock_page(page)) in lock_page_killable()
621 return __lock_page_killable(page); in lock_page_killable()
633 static inline __sched int lock_page_async(struct page *page, in lock_page_async() argument
636 if (!trylock_page(page)) in lock_page_async()
637 return __lock_page_async(page, wait); in lock_page_async()
648 static inline __sched int lock_page_or_retry(struct page *page, struct mm_struct *mm, in lock_page_or_retry() argument
652 return trylock_page(page) || __lock_page_or_retry(page, mm, flags); in lock_page_or_retry()
659 extern void wait_on_page_bit(struct page *page, int bit_nr);
660 extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
669 static inline __sched void wait_on_page_locked(struct page *page) in wait_on_page_locked() argument
671 if (PageLocked(page)) in wait_on_page_locked()
672 wait_on_page_bit(compound_head(page), PG_locked); in wait_on_page_locked()
675 static inline __sched int wait_on_page_locked_killable(struct page *page) in wait_on_page_locked_killable() argument
677 if (!PageLocked(page)) in wait_on_page_locked_killable()
679 return wait_on_page_bit_killable(compound_head(page), PG_locked); in wait_on_page_locked_killable()
682 extern void put_and_wait_on_page_locked(struct page *page);
684 void wait_on_page_writeback(struct page *page);
685 extern void end_page_writeback(struct page *page);
686 void wait_for_stable_page(struct page *page);
688 void page_endio(struct page *page, bool is_write, int err);
693 extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter);
752 int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
754 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
756 extern void delete_from_page_cache(struct page *page);
757 extern void __delete_from_page_cache(struct page *page, void *shadow);
758 int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
766 static inline int add_to_page_cache(struct page *page, in add_to_page_cache() argument
771 __SetPageLocked(page); in add_to_page_cache()
772 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); in add_to_page_cache()
774 __ClearPageLocked(page); in add_to_page_cache()
816 struct page *, unsigned long req_count);
857 struct page *page, pgoff_t index, unsigned long req_count) in page_cache_async_readahead() argument
860 page_cache_async_ra(&ractl, ra, page, req_count); in page_cache_async_readahead()
872 static inline struct page *readahead_page(struct readahead_control *rac) in readahead_page()
874 struct page *page; in readahead_page() local
885 page = xa_load(&rac->mapping->i_pages, rac->_index); in readahead_page()
886 VM_BUG_ON_PAGE(!PageLocked(page), page); in readahead_page()
887 rac->_batch_count = thp_nr_pages(page); in readahead_page()
889 return page; in readahead_page()
893 struct page **array, unsigned int array_sz) in __readahead_batch()
897 struct page *page; in __readahead_batch() local
906 xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { in __readahead_batch()
907 if (xas_retry(&xas, page)) in __readahead_batch()
909 VM_BUG_ON_PAGE(!PageLocked(page), page); in __readahead_batch()
910 VM_BUG_ON_PAGE(PageTail(page), page); in __readahead_batch()
911 array[i++] = page; in __readahead_batch()
912 rac->_batch_count += thp_nr_pages(page); in __readahead_batch()
920 if (PageHead(page)) in __readahead_batch()
995 static inline int page_mkwrite_check_truncate(struct page *page, in page_mkwrite_check_truncate() argument
1002 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()
1006 if (page->index < index) in page_mkwrite_check_truncate()
1009 if (page->index > index || !offset) in page_mkwrite_check_truncate()
1027 unsigned int i_blocks_per_page(struct inode *inode, struct page *page) in i_blocks_per_page() argument
1029 return thp_size(page) >> inode->i_blkbits; in i_blocks_per_page()