Lines Matching full:mapping
21 unsigned long invalidate_mapping_pages(struct address_space *mapping,
30 int invalidate_inode_pages2(struct address_space *mapping);
31 int invalidate_inode_pages2_range(struct address_space *mapping,
39 int filemap_fdatawait_keep_errors(struct address_space *mapping);
41 int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
44 static inline int filemap_fdatawait(struct address_space *mapping) in filemap_fdatawait() argument
46 return filemap_fdatawait_range(mapping, 0, LLONG_MAX); in filemap_fdatawait()
50 int filemap_write_and_wait_range(struct address_space *mapping,
52 int __filemap_fdatawrite_range(struct address_space *mapping,
54 int filemap_fdatawrite_range(struct address_space *mapping,
56 int filemap_check_errors(struct address_space *mapping);
57 void __filemap_set_wb_err(struct address_space *mapping, int err);
58 int filemap_fdatawrite_wbc(struct address_space *mapping,
62 static inline int filemap_write_and_wait(struct address_space *mapping) in filemap_write_and_wait() argument
64 return filemap_write_and_wait_range(mapping, 0, LLONG_MAX); in filemap_write_and_wait()
69 * @mapping: mapping in which to set writeback error
70 * @err: error to be set in mapping
78 * filemap_set_wb_err to record the error in the mapping so that it will be
81 static inline void filemap_set_wb_err(struct address_space *mapping, int err) in filemap_set_wb_err() argument
85 __filemap_set_wb_err(mapping, err); in filemap_set_wb_err()
90 * @mapping: mapping to check for writeback errors
93 * Grab the errseq_t value from the mapping, and see if it has changed "since"
98 static inline int filemap_check_wb_err(struct address_space *mapping, in filemap_check_wb_err() argument
101 return errseq_check(&mapping->wb_err, since); in filemap_check_wb_err()
106 * @mapping: mapping to be sampled
111 static inline errseq_t filemap_sample_wb_err(struct address_space *mapping) in filemap_sample_wb_err() argument
113 return errseq_sample(&mapping->wb_err); in filemap_sample_wb_err()
139 static inline bool mapping_empty(struct address_space *mapping) in mapping_empty() argument
141 return xa_empty(&mapping->i_pages); in mapping_empty()
146 * @mapping: the page cache mapping
148 * This checks the mapping's cache state for the pupose of inode
165 static inline bool mapping_shrinkable(struct address_space *mapping) in mapping_shrinkable() argument
178 head = rcu_access_pointer(mapping->i_pages.xa_head); in mapping_shrinkable()
195 * Bits in mapping->flags.
209 AS_UNMOVABLE, /* The mapping cannot be moved, ever */
214 * @mapping: the mapping in which an error should be set
215 * @error: the error to set in the mapping
223 * mapping_set_error to record the error in the mapping so that it can be
226 static inline void mapping_set_error(struct address_space *mapping, int error) in mapping_set_error() argument
232 __filemap_set_wb_err(mapping, error); in mapping_set_error()
235 if (mapping->host) in mapping_set_error()
236 errseq_set(&mapping->host->i_sb->s_wb_err, error); in mapping_set_error()
240 set_bit(AS_ENOSPC, &mapping->flags); in mapping_set_error()
242 set_bit(AS_EIO, &mapping->flags); in mapping_set_error()
245 static inline void mapping_set_unevictable(struct address_space *mapping) in mapping_set_unevictable() argument
247 set_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_set_unevictable()
250 static inline void mapping_clear_unevictable(struct address_space *mapping) in mapping_clear_unevictable() argument
252 clear_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_clear_unevictable()
255 static inline bool mapping_unevictable(struct address_space *mapping) in mapping_unevictable() argument
257 return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_unevictable()
260 static inline void mapping_set_exiting(struct address_space *mapping) in mapping_set_exiting() argument
262 set_bit(AS_EXITING, &mapping->flags); in mapping_set_exiting()
265 static inline int mapping_exiting(struct address_space *mapping) in mapping_exiting() argument
267 return test_bit(AS_EXITING, &mapping->flags); in mapping_exiting()
270 static inline void mapping_set_no_writeback_tags(struct address_space *mapping) in mapping_set_no_writeback_tags() argument
272 set_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_set_no_writeback_tags()
275 static inline int mapping_use_writeback_tags(struct address_space *mapping) in mapping_use_writeback_tags() argument
277 return !test_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_use_writeback_tags()
280 static inline bool mapping_release_always(const struct address_space *mapping) in mapping_release_always() argument
282 return test_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_release_always()
285 static inline void mapping_set_release_always(struct address_space *mapping) in mapping_set_release_always() argument
287 set_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_set_release_always()
290 static inline void mapping_clear_release_always(struct address_space *mapping) in mapping_clear_release_always() argument
292 clear_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_clear_release_always()
295 static inline bool mapping_stable_writes(const struct address_space *mapping) in mapping_stable_writes() argument
297 return test_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_stable_writes()
300 static inline void mapping_set_stable_writes(struct address_space *mapping) in mapping_set_stable_writes() argument
302 set_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_set_stable_writes()
305 static inline void mapping_clear_stable_writes(struct address_space *mapping) in mapping_clear_stable_writes() argument
307 clear_bit(AS_STABLE_WRITES, &mapping->flags); in mapping_clear_stable_writes()
310 static inline void mapping_set_unmovable(struct address_space *mapping) in mapping_set_unmovable() argument
317 set_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_set_unmovable()
318 set_bit(AS_UNMOVABLE, &mapping->flags); in mapping_set_unmovable()
321 static inline bool mapping_unmovable(struct address_space *mapping) in mapping_unmovable() argument
323 return test_bit(AS_UNMOVABLE, &mapping->flags); in mapping_unmovable()
326 static inline gfp_t mapping_gfp_mask(struct address_space * mapping) in mapping_gfp_mask() argument
328 return mapping->gfp_mask; in mapping_gfp_mask()
331 /* Restricts the given gfp_mask to what the mapping allows. */
332 static inline gfp_t mapping_gfp_constraint(struct address_space *mapping, in mapping_gfp_constraint() argument
335 return mapping_gfp_mask(mapping) & gfp_mask; in mapping_gfp_constraint()
339 * This is non-atomic. Only to be used before the mapping is activated.
349 * @mapping: The file.
358 static inline void mapping_set_large_folios(struct address_space *mapping) in mapping_set_large_folios() argument
360 __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); in mapping_set_large_folios()
367 static inline bool mapping_large_folio_support(struct address_space *mapping) in mapping_large_folio_support() argument
370 test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); in mapping_large_folio_support()
373 static inline int filemap_nr_thps(struct address_space *mapping) in filemap_nr_thps() argument
376 return atomic_read(&mapping->nr_thps); in filemap_nr_thps()
382 static inline void filemap_nr_thps_inc(struct address_space *mapping) in filemap_nr_thps_inc() argument
385 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_inc()
386 atomic_inc(&mapping->nr_thps); in filemap_nr_thps_inc()
388 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_inc()
392 static inline void filemap_nr_thps_dec(struct address_space *mapping) in filemap_nr_thps_dec() argument
395 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_dec()
396 atomic_dec(&mapping->nr_thps); in filemap_nr_thps_dec()
398 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_dec()
407 * folio_file_mapping - Find the mapping this folio belongs to.
410 * For folios which are in the page cache, return the mapping that this
411 * page belongs to. Folios in the swap cache return the mapping of the
413 * from the mapping returned by folio_mapping(). The only reason to
423 return folio->mapping; in folio_file_mapping()
427 * folio_flush_mapping - Find the file mapping this folio belongs to.
430 * For folios which are in the page cache, return the mapping that this
462 return folio->mapping->host; in folio_inode()
570 pgoff_t page_cache_next_miss(struct address_space *mapping,
572 pgoff_t page_cache_prev_miss(struct address_space *mapping,
633 void *filemap_get_entry(struct address_space *mapping, pgoff_t index);
634 struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
636 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
641 * @mapping: The address_space to search.
644 * Looks up the page cache entry at @mapping & @index. If a folio is
650 static inline struct folio *filemap_get_folio(struct address_space *mapping, in filemap_get_folio() argument
653 return __filemap_get_folio(mapping, index, 0, 0); in filemap_get_folio()
658 * @mapping: The address_space to search.
661 * Looks up the page cache entry at @mapping & @index. If a folio is
668 static inline struct folio *filemap_lock_folio(struct address_space *mapping, in filemap_lock_folio() argument
671 return __filemap_get_folio(mapping, index, FGP_LOCK, 0); in filemap_lock_folio()
676 * @mapping: The address space to search
679 * Looks up the page cache entry at @mapping & @index. If no folio is found,
686 static inline struct folio *filemap_grab_folio(struct address_space *mapping, in filemap_grab_folio() argument
689 return __filemap_get_folio(mapping, index, in filemap_grab_folio()
691 mapping_gfp_mask(mapping)); in filemap_grab_folio()
696 * @mapping: the address_space to search
699 * Looks up the page cache slot at @mapping & @offset. If there is a
704 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page() argument
707 return pagecache_get_page(mapping, offset, 0, 0); in find_get_page()
710 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags() argument
713 return pagecache_get_page(mapping, offset, fgp_flags, 0); in find_get_page_flags()
718 * @mapping: the address_space to search
721 * Looks up the page cache entry at @mapping & @index. If there is a
729 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page() argument
732 return pagecache_get_page(mapping, index, FGP_LOCK, 0); in find_lock_page()
737 * @mapping: the page's address_space
738 * @index: the page's index into the mapping
741 * Looks up the page cache slot at @mapping & @offset. If there is a
754 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page() argument
757 return pagecache_get_page(mapping, index, in find_or_create_page()
764 * @mapping: target address_space
775 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait() argument
778 return pagecache_get_page(mapping, index, in grab_cache_page_nowait()
780 mapping_gfp_mask(mapping)); in grab_cache_page_nowait()
857 unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
859 unsigned filemap_get_folios_contig(struct address_space *mapping,
861 unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
864 struct page *grab_cache_page_write_begin(struct address_space *mapping,
870 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page() argument
873 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); in grab_cache_page()
882 extern struct page * read_cache_page_gfp(struct address_space *mapping,
885 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page() argument
888 return read_cache_page(mapping, index, NULL, file); in read_mapping_page()
891 static inline struct folio *read_mapping_folio(struct address_space *mapping, in read_mapping_folio() argument
894 return read_cache_folio(mapping, index, NULL, file); in read_mapping_folio()
1030 * is sufficient to keep folio->mapping stable.
1148 struct address_space *mapping, int warn) in __set_page_dirty() argument
1150 __folio_mark_dirty(page_folio(page), mapping, warn); in __set_page_dirty()
1164 bool noop_dirty_folio(struct address_space *mapping, struct folio *folio);
1167 int filemap_migrate_folio(struct address_space *mapping, struct folio *dst,
1189 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
1191 int filemap_add_folio(struct address_space *mapping, struct folio *folio,
1196 void delete_from_page_cache_batch(struct address_space *mapping,
1203 int __filemap_add_folio(struct address_space *mapping, struct folio *folio,
1206 bool filemap_range_has_writeback(struct address_space *mapping,
1211 * @mapping: address space within which to check
1223 static inline bool filemap_range_needs_writeback(struct address_space *mapping, in filemap_range_needs_writeback() argument
1227 if (!mapping->nrpages) in filemap_range_needs_writeback()
1229 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) && in filemap_range_needs_writeback()
1230 !mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) in filemap_range_needs_writeback()
1232 return filemap_range_has_writeback(mapping, start_byte, end_byte); in filemap_range_needs_writeback()
1248 * @mapping: Readahead this filesystem object.
1253 struct address_space *mapping; member
1266 .mapping = m, \
1283 * @mapping: address_space which holds the pagecache and I/O vectors
1295 void page_cache_sync_readahead(struct address_space *mapping, in page_cache_sync_readahead() argument
1299 DEFINE_READAHEAD(ractl, file, ra, mapping, index); in page_cache_sync_readahead()
1305 * @mapping: address_space which holds the pagecache and I/O vectors
1318 void page_cache_async_readahead(struct address_space *mapping, in page_cache_async_readahead() argument
1322 DEFINE_READAHEAD(ractl, file, ra, mapping, index); in page_cache_async_readahead()
1339 folio = xa_load(&ractl->mapping->i_pages, ractl->_index); in __readahead_folio()
1383 XA_STATE(xas, &rac->mapping->i_pages, 0); in __readahead_batch()
1488 if (!folio->mapping) in folio_mkwrite_check_truncate()
1516 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()