Lines Matching +full:data +full:- +full:mapping

1 /* SPDX-License-Identifier: GPL-2.0 */
21 unsigned long invalidate_mapping_pages(struct address_space *mapping,
26 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || in invalidate_remote_inode()
27 S_ISLNK(inode->i_mode)) in invalidate_remote_inode()
28 invalidate_mapping_pages(inode->i_mapping, 0, -1); in invalidate_remote_inode()
30 int invalidate_inode_pages2(struct address_space *mapping);
31 int invalidate_inode_pages2_range(struct address_space *mapping,
35 int filemap_invalidate_pages(struct address_space *mapping,
41 int filemap_fdatawait_keep_errors(struct address_space *mapping);
43 int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
48 static inline int filemap_fdatawait(struct address_space *mapping) in filemap_fdatawait() argument
50 return filemap_fdatawait_range(mapping, 0, LLONG_MAX); in filemap_fdatawait()
54 int filemap_write_and_wait_range(struct address_space *mapping,
56 int __filemap_fdatawrite_range(struct address_space *mapping,
58 int filemap_fdatawrite_range(struct address_space *mapping,
60 int filemap_check_errors(struct address_space *mapping);
61 void __filemap_set_wb_err(struct address_space *mapping, int err);
62 int filemap_fdatawrite_wbc(struct address_space *mapping,
66 static inline int filemap_write_and_wait(struct address_space *mapping) in filemap_write_and_wait() argument
68 return filemap_write_and_wait_range(mapping, 0, LLONG_MAX); in filemap_write_and_wait()
72 * filemap_set_wb_err - set a writeback error on an address_space
73 * @mapping: mapping in which to set writeback error
74 * @err: error to be set in mapping
82 * filemap_set_wb_err to record the error in the mapping so that it will be
85 static inline void filemap_set_wb_err(struct address_space *mapping, int err) in filemap_set_wb_err() argument
89 __filemap_set_wb_err(mapping, err); in filemap_set_wb_err()
93 * filemap_check_wb_err - has an error occurred since the mark was sampled?
94 * @mapping: mapping to check for writeback errors
95 * @since: previously-sampled errseq_t
97 * Grab the errseq_t value from the mapping, and see if it has changed "since"
102 static inline int filemap_check_wb_err(struct address_space *mapping, in filemap_check_wb_err() argument
105 return errseq_check(&mapping->wb_err, since); in filemap_check_wb_err()
109 * filemap_sample_wb_err - sample the current errseq_t to test for later errors
110 * @mapping: mapping to be sampled
115 static inline errseq_t filemap_sample_wb_err(struct address_space *mapping) in filemap_sample_wb_err() argument
117 return errseq_sample(&mapping->wb_err); in filemap_sample_wb_err()
121 * file_sample_sb_err - sample the current errseq_t to test for later errors
124 * Grab the most current superblock-level errseq_t value for the given
129 return errseq_sample(&file->f_path.dentry->d_sb->s_wb_err); in file_sample_sb_err()
133 * Flush file data before changing attributes. Caller must hold any locks
140 return filemap_write_and_wait(inode->i_mapping); in inode_drain_writes()
143 static inline bool mapping_empty(struct address_space *mapping) in mapping_empty() argument
145 return xa_empty(&mapping->i_pages); in mapping_empty()
149 * mapping_shrinkable - test if page cache state allows inode reclaim
150 * @mapping: the page cache mapping
152 * This checks the mapping's cache state for the pupose of inode
158 * its LRU state don't nest inside the irq-safe i_pages lock.
169 static inline bool mapping_shrinkable(struct address_space *mapping) in mapping_shrinkable() argument
182 head = rcu_access_pointer(mapping->i_pages.xa_head); in mapping_shrinkable()
187 * The xarray stores single offset-0 entries directly in the in mapping_shrinkable()
188 * head pointer, which allows non-resident page cache entries in mapping_shrinkable()
199 * Bits in mapping->flags.
209 AS_RELEASE_ALWAYS = 6, /* Call ->release_folio(), even if no private data */
212 AS_INACCESSIBLE = 8, /* Do not attempt direct R/W access to the mapping */
213 /* Bits 16-25 are used for FOLIO_ORDER */
219 #define AS_FOLIO_ORDER_BITS_MASK ((1u << AS_FOLIO_ORDER_BITS) - 1)
225 * mapping_set_error - record a writeback error in the address_space
226 * @mapping: the mapping in which an error should be set
227 * @error: the error to set in the mapping
235 * mapping_set_error to record the error in the mapping so that it can be
238 static inline void mapping_set_error(struct address_space *mapping, int error) in mapping_set_error() argument
244 __filemap_set_wb_err(mapping, error); in mapping_set_error()
247 if (mapping->host) in mapping_set_error()
248 errseq_set(&mapping->host->i_sb->s_wb_err, error); in mapping_set_error()
251 if (error == -ENOSPC) in mapping_set_error()
252 set_bit(AS_ENOSPC, &mapping->flags); in mapping_set_error()
254 set_bit(AS_EIO, &mapping->flags); in mapping_set_error()
257 static inline void mapping_set_unevictable(struct address_space *mapping) in mapping_set_unevictable() argument
259 set_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_set_unevictable()
262 static inline void mapping_clear_unevictable(struct address_space *mapping) in mapping_clear_unevictable() argument
264 clear_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_clear_unevictable()
267 static inline bool mapping_unevictable(struct address_space *mapping) in mapping_unevictable() argument
269 return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_unevictable()
272 static inline void mapping_set_exiting(struct address_space *mapping) in mapping_set_exiting() argument
274 set_bit(AS_EXITING, &mapping->flags); in mapping_set_exiting()
277 static inline int mapping_exiting(struct address_space *mapping) in mapping_exiting() argument
279 return test_bit(AS_EXITING, &mapping->flags); in mapping_exiting()
282 static inline void mapping_set_no_writeback_tags(struct address_space *mapping) in mapping_set_no_writeback_tags() argument
284 set_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_set_no_writeback_tags()
287 static inline int mapping_use_writeback_tags(struct address_space *mapping) in mapping_use_writeback_tags() argument
289 return !test_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_use_writeback_tags()
292 static inline bool mapping_release_always(const struct address_space *mapping) in mapping_release_always() argument
294 return test_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_release_always()
297 static inline void mapping_set_release_always(struct address_space *mapping) in mapping_set_release_always() argument
299 set_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_set_release_always()
302 static inline void mapping_clear_release_always(struct address_space *mapping) in mapping_clear_release_always() argument
304 clear_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_clear_release_always()
307 static inline bool mapping_stable_writes(const struct address_space *mapping) in mapping_stable_writes() argument
309 return test_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_stable_writes()
312 static inline void mapping_set_stable_writes(struct address_space *mapping) in mapping_set_stable_writes() argument
314 set_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_set_stable_writes()
317 static inline void mapping_clear_stable_writes(struct address_space *mapping) in mapping_clear_stable_writes() argument
319 clear_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_clear_stable_writes()
322 static inline void mapping_set_inaccessible(struct address_space *mapping) in mapping_set_inaccessible() argument
329 set_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_set_inaccessible()
330 set_bit(AS_INACCESSIBLE, &mapping->flags); in mapping_set_inaccessible()
333 static inline bool mapping_inaccessible(struct address_space *mapping) in mapping_inaccessible() argument
335 return test_bit(AS_INACCESSIBLE, &mapping->flags); in mapping_inaccessible()
338 static inline gfp_t mapping_gfp_mask(struct address_space * mapping) in mapping_gfp_mask() argument
340 return mapping->gfp_mask; in mapping_gfp_mask()
343 /* Restricts the given gfp_mask to what the mapping allows. */
344 static inline gfp_t mapping_gfp_constraint(struct address_space *mapping, in mapping_gfp_constraint() argument
347 return mapping_gfp_mask(mapping) & gfp_mask; in mapping_gfp_constraint()
351 * This is non-atomic. Only to be used before the mapping is activated.
356 m->gfp_mask = mask; in mapping_set_gfp_mask()
376 #define MAX_XAS_ORDER (XA_CHUNK_SHIFT * 2 - 1)
380 * mapping_max_folio_size_supported() - Check the max folio size supported
383 * requirement on the folio mapping size in the page cache.
393 * mapping_set_folio_order_range() - Set the orders supported by a file.
394 * @mapping: The address space of the file.
395 * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive).
396 * @max: Maximum folio order (between @min-MAX_PAGECACHE_ORDER inclusive).
406 * is non-atomic.
408 static inline void mapping_set_folio_order_range(struct address_space *mapping, in mapping_set_folio_order_range() argument
424 mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | in mapping_set_folio_order_range()
428 static inline void mapping_set_folio_min_order(struct address_space *mapping, in mapping_set_folio_min_order() argument
431 mapping_set_folio_order_range(mapping, min, MAX_PAGECACHE_ORDER); in mapping_set_folio_min_order()
435 * mapping_set_large_folios() - Indicate the file supports large folios.
436 * @mapping: The address space of the file.
443 * is non-atomic.
445 static inline void mapping_set_large_folios(struct address_space *mapping) in mapping_set_large_folios() argument
447 mapping_set_folio_order_range(mapping, 0, MAX_PAGECACHE_ORDER); in mapping_set_large_folios()
451 mapping_max_folio_order(const struct address_space *mapping) in mapping_max_folio_order() argument
455 return (mapping->flags & AS_FOLIO_ORDER_MAX_MASK) >> AS_FOLIO_ORDER_MAX; in mapping_max_folio_order()
459 mapping_min_folio_order(const struct address_space *mapping) in mapping_min_folio_order() argument
463 return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN; in mapping_min_folio_order()
467 mapping_min_folio_nrpages(struct address_space *mapping) in mapping_min_folio_nrpages() argument
469 return 1UL << mapping_min_folio_order(mapping); in mapping_min_folio_nrpages()
473 * mapping_align_index() - Align index for this mapping.
474 * @mapping: The address_space.
481 static inline pgoff_t mapping_align_index(struct address_space *mapping, in mapping_align_index() argument
484 return round_down(index, mapping_min_folio_nrpages(mapping)); in mapping_align_index()
491 static inline bool mapping_large_folio_support(struct address_space *mapping) in mapping_large_folio_support() argument
494 VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON, in mapping_large_folio_support()
495 "Anonymous mapping always supports large folio"); in mapping_large_folio_support()
497 return mapping_max_folio_order(mapping) > 0; in mapping_large_folio_support()
500 /* Return the maximum folio size for this pagecache mapping, in bytes. */
501 static inline size_t mapping_max_folio_size(const struct address_space *mapping) in mapping_max_folio_size() argument
503 return PAGE_SIZE << mapping_max_folio_order(mapping); in mapping_max_folio_size()
506 static inline int filemap_nr_thps(struct address_space *mapping) in filemap_nr_thps() argument
509 return atomic_read(&mapping->nr_thps); in filemap_nr_thps()
515 static inline void filemap_nr_thps_inc(struct address_space *mapping) in filemap_nr_thps_inc() argument
518 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_inc()
519 atomic_inc(&mapping->nr_thps); in filemap_nr_thps_inc()
521 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_inc()
525 static inline void filemap_nr_thps_dec(struct address_space *mapping) in filemap_nr_thps_dec() argument
528 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_dec()
529 atomic_dec(&mapping->nr_thps); in filemap_nr_thps_dec()
531 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_dec()
539 * folio_file_mapping - Find the mapping this folio belongs to.
542 * For folios which are in the page cache, return the mapping that this
543 * page belongs to. Folios in the swap cache return the mapping of the
544 * swap file or swap device where the data is stored. This is different
545 * from the mapping returned by folio_mapping(). The only reason to
546 * use it is if, like NFS, you return 0 from ->activate_swapfile.
555 return folio->mapping; in folio_file_mapping()
559 * folio_flush_mapping - Find the file mapping this folio belongs to.
562 * For folios which are in the page cache, return the mapping that this
584 * folio_inode - Get the host inode for this folio.
594 return folio->mapping->host; in folio_inode()
598 * folio_attach_private - Attach private data to a folio.
599 * @folio: Folio to attach data to.
600 * @data: Data to attach to folio.
602 * Attaching private data to a folio increments the page's reference count.
603 * The data must be detached before the folio will be freed.
605 static inline void folio_attach_private(struct folio *folio, void *data) in folio_attach_private() argument
608 folio->private = data; in folio_attach_private()
613 * folio_change_private - Change private data on a folio.
614 * @folio: Folio to change the data on.
615 * @data: Data to set on the folio.
617 * Change the private data attached to a folio and return the old
618 * data. The page must previously have had data attached and the data
621 * Return: Data that was previously attached to the folio.
623 static inline void *folio_change_private(struct folio *folio, void *data) in folio_change_private() argument
627 folio->private = data; in folio_change_private()
632 * folio_detach_private - Detach private data from a folio.
633 * @folio: Folio to detach data from.
635 * Removes the data that was previously attached to the folio and decrements
638 * Return: Data that was attached to the folio.
642 void *data = folio_get_private(folio); in folio_detach_private() local
647 folio->private = NULL; in folio_detach_private()
650 return data; in folio_detach_private()
653 static inline void attach_page_private(struct page *page, void *data) in attach_page_private() argument
655 folio_attach_private(page_folio(page), data); in attach_page_private()
677 return &filemap_alloc_folio(gfp, 0)->page; in __page_cache_alloc()
687 pgoff_t page_cache_next_miss(struct address_space *mapping,
689 pgoff_t page_cache_prev_miss(struct address_space *mapping,
693 * typedef fgf_t - Flags for getting folios from the page cache.
701 * * %FGP_ACCESSED - The folio will be marked accessed.
702 * * %FGP_LOCK - The folio is returned locked.
703 * * %FGP_CREAT - If no folio is present then a new folio is allocated,
706 * * %FGP_FOR_MMAP - The caller wants to do its own locking dance if the
709 * * %FGP_WRITE - The folio will be written to by the caller.
710 * * %FGP_NOFS - __GFP_FS will get cleared in gfp.
711 * * %FGP_NOWAIT - Don't block on the folio lock.
712 * * %FGP_STABLE - Wait for the folio to be stable (finished writeback)
713 * * %FGP_WRITEBEGIN - The flags to use in a filesystem write_begin()
731 * fgf_set_order - Encode a length in the fgf_t flags.
747 return (__force fgf_t)((shift - PAGE_SHIFT) << 26); in fgf_set_order()
750 void *filemap_get_entry(struct address_space *mapping, pgoff_t index);
751 struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
753 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
757 * filemap_get_folio - Find and get a folio.
758 * @mapping: The address_space to search.
761 * Looks up the page cache entry at @mapping & @index. If a folio is
764 * Return: A folio or ERR_PTR(-ENOENT) if there is no folio in the cache for
767 static inline struct folio *filemap_get_folio(struct address_space *mapping, in filemap_get_folio() argument
770 return __filemap_get_folio(mapping, index, 0, 0); in filemap_get_folio()
774 * filemap_lock_folio - Find and lock a folio.
775 * @mapping: The address_space to search.
778 * Looks up the page cache entry at @mapping & @index. If a folio is
782 * Return: A folio or ERR_PTR(-ENOENT) if there is no folio in the cache for
785 static inline struct folio *filemap_lock_folio(struct address_space *mapping, in filemap_lock_folio() argument
788 return __filemap_get_folio(mapping, index, FGP_LOCK, 0); in filemap_lock_folio()
792 * filemap_grab_folio - grab a folio from the page cache
793 * @mapping: The address space to search
796 * Looks up the page cache entry at @mapping & @index. If no folio is found,
800 * Return: A found or created folio. ERR_PTR(-ENOMEM) if no folio is found
803 static inline struct folio *filemap_grab_folio(struct address_space *mapping, in filemap_grab_folio() argument
806 return __filemap_get_folio(mapping, index, in filemap_grab_folio()
808 mapping_gfp_mask(mapping)); in filemap_grab_folio()
812 * find_get_page - find and get a page reference
813 * @mapping: the address_space to search
816 * Looks up the page cache slot at @mapping & @offset. If there is a
821 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page() argument
824 return pagecache_get_page(mapping, offset, 0, 0); in find_get_page()
827 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags() argument
830 return pagecache_get_page(mapping, offset, fgp_flags, 0); in find_get_page_flags()
834 * find_lock_page - locate, pin and lock a pagecache page
835 * @mapping: the address_space to search
838 * Looks up the page cache entry at @mapping & @index. If there is a
846 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page() argument
849 return pagecache_get_page(mapping, index, FGP_LOCK, 0); in find_lock_page()
853 * find_or_create_page - locate or add a pagecache page
854 * @mapping: the page's address_space
855 * @index: the page's index into the mapping
858 * Looks up the page cache slot at @mapping & @offset. If there is a
871 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page() argument
874 return pagecache_get_page(mapping, index, in find_or_create_page()
880 * grab_cache_page_nowait - returns locked page at given index in given cache
881 * @mapping: target address_space
885 * This is intended for speculative data generators, where the data can
892 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait() argument
895 return pagecache_get_page(mapping, index, in grab_cache_page_nowait()
897 mapping_gfp_mask(mapping)); in grab_cache_page_nowait()
903 * folio_index - File index of a folio.
917 return folio->index; in folio_index()
921 * folio_next_index - Get the index of the next folio.
928 return folio->index + folio_nr_pages(folio); in folio_next_index()
932 * folio_file_page - The page for a particular index.
939 * Return: The page containing the file data for this index.
943 return folio_page(folio, index & (folio_nr_pages(folio) - 1)); in folio_file_page()
947 * folio_contains - Does this folio contain this index?
958 return index - folio_index(folio) < folio_nr_pages(folio); in folio_contains()
971 return head + (index & (thp_nr_pages(head) - 1)); in find_subpage()
974 unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
976 unsigned filemap_get_folios_contig(struct address_space *mapping,
978 unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
981 struct page *grab_cache_page_write_begin(struct address_space *mapping,
987 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page() argument
990 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); in grab_cache_page()
999 extern struct page * read_cache_page_gfp(struct address_space *mapping,
1002 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page() argument
1005 return read_cache_page(mapping, index, NULL, file); in read_mapping_page()
1008 static inline struct folio *read_mapping_folio(struct address_space *mapping, in read_mapping_folio() argument
1011 return read_cache_folio(mapping, index, NULL, file); in read_mapping_folio()
1022 return page->index; in page_to_pgoff()
1026 * We don't initialize ->index for tail pages: calculate based on in page_to_pgoff()
1029 return head->index + page - head; in page_to_pgoff()
1033 * Return byte-offset into filesystem object for page.
1037 return ((loff_t)page->index) << PAGE_SHIFT; in page_offset()
1041 * folio_pos - Returns the byte position of this folio in its file.
1046 return page_offset(&folio->page); in folio_pos()
1054 return folio->index; in folio_pgoff()
1061 pgoff = (address - vma->vm_start) >> PAGE_SHIFT; in linear_page_index()
1062 pgoff += vma->vm_pgoff; in linear_page_index()
1081 if (wait_page->folio != key->folio) in wake_page_match()
1083 key->page_match = 1; in wake_page_match()
1085 if (wait_page->bit_nr != key->bit_nr) in wake_page_match()
1098 * folio_trylock() - Attempt to lock a folio.
1123 * folio_lock() - Lock this folio.
1130 * is sufficient to keep folio->mapping stable.
1134 * cross a page boundary). Other modifications to the data in the folio
1152 * lock_page() - Lock the folio containing this page.
1173 * folio_lock_killable() - Lock this folio, interruptible by a fatal signal.
1180 * Return: 0 if the lock was acquired; -EINTR if a fatal signal was received.
1191 * folio_lock_or_retry - Lock the folio, unless this would block and the
1258 bool noop_dirty_folio(struct address_space *mapping, struct folio *folio);
1261 int filemap_migrate_folio(struct address_space *mapping, struct folio *dst,
1283 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
1285 int filemap_add_folio(struct address_space *mapping, struct folio *folio,
1290 void delete_from_page_cache_batch(struct address_space *mapping,
1296 /* Must be non-static for BPF error injection */
1297 int __filemap_add_folio(struct address_space *mapping, struct folio *folio,
1300 bool filemap_range_has_writeback(struct address_space *mapping,
1304 * filemap_range_needs_writeback - check if range potentially needs writeback
1305 * @mapping: address space within which to check
1317 static inline bool filemap_range_needs_writeback(struct address_space *mapping, in filemap_range_needs_writeback() argument
1321 if (!mapping->nrpages) in filemap_range_needs_writeback()
1323 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) && in filemap_range_needs_writeback()
1324 !mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) in filemap_range_needs_writeback()
1326 return filemap_range_has_writeback(mapping, start_byte, end_byte); in filemap_range_needs_writeback()
1330 * struct readahead_control - Describes a readahead request.
1333 * implement the ->readahead method should call readahead_page() or
1342 * @mapping: Readahead this filesystem object.
1347 struct address_space *mapping; member
1360 .mapping = m, \
1376 * page_cache_sync_readahead - generic file readahead
1377 * @mapping: address_space which holds the pagecache and I/O vectors
1389 void page_cache_sync_readahead(struct address_space *mapping, in page_cache_sync_readahead() argument
1393 DEFINE_READAHEAD(ractl, file, ra, mapping, index); in page_cache_sync_readahead()
1398 * page_cache_async_readahead - file readahead for marked pages
1399 * @mapping: address_space which holds the pagecache and I/O vectors
1411 void page_cache_async_readahead(struct address_space *mapping, in page_cache_async_readahead() argument
1415 DEFINE_READAHEAD(ractl, file, ra, mapping, folio->index); in page_cache_async_readahead()
1423 BUG_ON(ractl->_batch_count > ractl->_nr_pages); in __readahead_folio()
1424 ractl->_nr_pages -= ractl->_batch_count; in __readahead_folio()
1425 ractl->_index += ractl->_batch_count; in __readahead_folio()
1427 if (!ractl->_nr_pages) { in __readahead_folio()
1428 ractl->_batch_count = 0; in __readahead_folio()
1432 folio = xa_load(&ractl->mapping->i_pages, ractl->_index); in __readahead_folio()
1434 ractl->_batch_count = folio_nr_pages(folio); in __readahead_folio()
1440 * readahead_page - Get the next page to read.
1452 return &folio->page; in readahead_page()
1456 * readahead_folio - Get the next folio to read.
1476 XA_STATE(xas, &rac->mapping->i_pages, 0); in __readahead_batch()
1479 BUG_ON(rac->_batch_count > rac->_nr_pages); in __readahead_batch()
1480 rac->_nr_pages -= rac->_batch_count; in __readahead_batch()
1481 rac->_index += rac->_batch_count; in __readahead_batch()
1482 rac->_batch_count = 0; in __readahead_batch()
1484 xas_set(&xas, rac->_index); in __readahead_batch()
1486 xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { in __readahead_batch()
1492 rac->_batch_count += thp_nr_pages(page); in __readahead_batch()
1502 * readahead_page_batch - Get a batch of pages to read.
1516 * readahead_pos - The byte offset into the file of this readahead request.
1521 return (loff_t)rac->_index * PAGE_SIZE; in readahead_pos()
1525 * readahead_length - The number of bytes in this readahead request.
1530 return rac->_nr_pages * PAGE_SIZE; in readahead_length()
1534 * readahead_index - The index of the first page in this readahead request.
1539 return rac->_index; in readahead_index()
1543 * readahead_count - The number of pages in this readahead request.
1548 return rac->_nr_pages; in readahead_count()
1552 * readahead_batch_length - The number of bytes in the current batch.
1557 return rac->_batch_count * PAGE_SIZE; in readahead_batch_length()
1562 return (unsigned long)(inode->i_size + PAGE_SIZE - 1) >> in dir_pages()
1567 * folio_mkwrite_check_truncate - check if folio was truncated
1572 * or -EFAULT if the folio was truncated.
1581 if (!folio->mapping) in folio_mkwrite_check_truncate()
1582 return -EFAULT; in folio_mkwrite_check_truncate()
1585 if (folio_next_index(folio) - 1 < index) in folio_mkwrite_check_truncate()
1588 if (folio->index > index || !offset) in folio_mkwrite_check_truncate()
1589 return -EFAULT; in folio_mkwrite_check_truncate()
1595 * page_mkwrite_check_truncate - check if page was truncated
1600 * or -EFAULT if the page was truncated.
1609 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()
1610 return -EFAULT; in page_mkwrite_check_truncate()
1613 if (page->index < index) in page_mkwrite_check_truncate()
1616 if (page->index > index || !offset) in page_mkwrite_check_truncate()
1617 return -EFAULT; in page_mkwrite_check_truncate()
1623 * i_blocks_per_folio - How many blocks fit in this folio.
1636 return folio_size(folio) >> inode->i_blkbits; in i_blocks_per_folio()