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.
211 * @mapping: the mapping in which an error should be set
212 * @error: the error to set in the mapping
220 * mapping_set_error to record the error in the mapping so that it can be
223 static inline void mapping_set_error(struct address_space *mapping, int error) in mapping_set_error() argument
229 __filemap_set_wb_err(mapping, error); in mapping_set_error()
232 if (mapping->host) in mapping_set_error()
233 errseq_set(&mapping->host->i_sb->s_wb_err, error); in mapping_set_error()
237 set_bit(AS_ENOSPC, &mapping->flags); in mapping_set_error()
239 set_bit(AS_EIO, &mapping->flags); in mapping_set_error()
242 static inline void mapping_set_unevictable(struct address_space *mapping) in mapping_set_unevictable() argument
244 set_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_set_unevictable()
247 static inline void mapping_clear_unevictable(struct address_space *mapping) in mapping_clear_unevictable() argument
249 clear_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_clear_unevictable()
252 static inline bool mapping_unevictable(struct address_space *mapping) in mapping_unevictable() argument
254 return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags); in mapping_unevictable()
257 static inline void mapping_set_exiting(struct address_space *mapping) in mapping_set_exiting() argument
259 set_bit(AS_EXITING, &mapping->flags); in mapping_set_exiting()
262 static inline int mapping_exiting(struct address_space *mapping) in mapping_exiting() argument
264 return test_bit(AS_EXITING, &mapping->flags); in mapping_exiting()
267 static inline void mapping_set_no_writeback_tags(struct address_space *mapping) in mapping_set_no_writeback_tags() argument
269 set_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_set_no_writeback_tags()
272 static inline int mapping_use_writeback_tags(struct address_space *mapping) in mapping_use_writeback_tags() argument
274 return !test_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags); in mapping_use_writeback_tags()
277 static inline bool mapping_release_always(const struct address_space *mapping) in mapping_release_always() argument
279 return test_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_release_always()
282 static inline void mapping_set_release_always(struct address_space *mapping) in mapping_set_release_always() argument
284 set_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_set_release_always()
287 static inline void mapping_clear_release_always(struct address_space *mapping) in mapping_clear_release_always() argument
289 clear_bit(AS_RELEASE_ALWAYS, &mapping->flags); in mapping_clear_release_always()
292 static inline gfp_t mapping_gfp_mask(struct address_space * mapping) in mapping_gfp_mask() argument
294 return mapping->gfp_mask; in mapping_gfp_mask()
297 /* Restricts the given gfp_mask to what the mapping allows. */
298 static inline gfp_t mapping_gfp_constraint(struct address_space *mapping, in mapping_gfp_constraint() argument
301 return mapping_gfp_mask(mapping) & gfp_mask; in mapping_gfp_constraint()
305 * This is non-atomic. Only to be used before the mapping is activated.
315 * @mapping: The file.
324 static inline void mapping_set_large_folios(struct address_space *mapping) in mapping_set_large_folios() argument
326 __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); in mapping_set_large_folios()
333 static inline bool mapping_large_folio_support(struct address_space *mapping) in mapping_large_folio_support() argument
336 test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); in mapping_large_folio_support()
339 static inline int filemap_nr_thps(struct address_space *mapping) in filemap_nr_thps() argument
342 return atomic_read(&mapping->nr_thps); in filemap_nr_thps()
348 static inline void filemap_nr_thps_inc(struct address_space *mapping) in filemap_nr_thps_inc() argument
351 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_inc()
352 atomic_inc(&mapping->nr_thps); in filemap_nr_thps_inc()
354 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_inc()
358 static inline void filemap_nr_thps_dec(struct address_space *mapping) in filemap_nr_thps_dec() argument
361 if (!mapping_large_folio_support(mapping)) in filemap_nr_thps_dec()
362 atomic_dec(&mapping->nr_thps); in filemap_nr_thps_dec()
364 WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0); in filemap_nr_thps_dec()
373 * folio_file_mapping - Find the mapping this folio belongs to.
376 * For folios which are in the page cache, return the mapping that this
377 * page belongs to. Folios in the swap cache return the mapping of the
379 * from the mapping returned by folio_mapping(). The only reason to
389 return folio->mapping; in folio_file_mapping()
393 * folio_flush_mapping - Find the file mapping this folio belongs to.
396 * For folios which are in the page cache, return the mapping that this
428 return folio->mapping->host; in folio_inode()
536 pgoff_t page_cache_next_miss(struct address_space *mapping,
538 pgoff_t page_cache_prev_miss(struct address_space *mapping,
599 void *filemap_get_entry(struct address_space *mapping, pgoff_t index);
600 struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
602 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
607 * @mapping: The address_space to search.
610 * Looks up the page cache entry at @mapping & @index. If a folio is
616 static inline struct folio *filemap_get_folio(struct address_space *mapping, in filemap_get_folio() argument
619 return __filemap_get_folio(mapping, index, 0, 0); in filemap_get_folio()
624 * @mapping: The address_space to search.
627 * Looks up the page cache entry at @mapping & @index. If a folio is
634 static inline struct folio *filemap_lock_folio(struct address_space *mapping, in filemap_lock_folio() argument
637 return __filemap_get_folio(mapping, index, FGP_LOCK, 0); in filemap_lock_folio()
642 * @mapping: The address space to search
645 * Looks up the page cache entry at @mapping & @index. If no folio is found,
652 static inline struct folio *filemap_grab_folio(struct address_space *mapping, in filemap_grab_folio() argument
655 return __filemap_get_folio(mapping, index, in filemap_grab_folio()
657 mapping_gfp_mask(mapping)); in filemap_grab_folio()
662 * @mapping: the address_space to search
665 * Looks up the page cache slot at @mapping & @offset. If there is a
670 static inline struct page *find_get_page(struct address_space *mapping, in find_get_page() argument
673 return pagecache_get_page(mapping, offset, 0, 0); in find_get_page()
676 static inline struct page *find_get_page_flags(struct address_space *mapping, in find_get_page_flags() argument
679 return pagecache_get_page(mapping, offset, fgp_flags, 0); in find_get_page_flags()
684 * @mapping: the address_space to search
687 * Looks up the page cache entry at @mapping & @index. If there is a
695 static inline struct page *find_lock_page(struct address_space *mapping, in find_lock_page() argument
698 return pagecache_get_page(mapping, index, FGP_LOCK, 0); in find_lock_page()
703 * @mapping: the page's address_space
704 * @index: the page's index into the mapping
707 * Looks up the page cache slot at @mapping & @offset. If there is a
720 static inline struct page *find_or_create_page(struct address_space *mapping, in find_or_create_page() argument
723 return pagecache_get_page(mapping, index, in find_or_create_page()
730 * @mapping: target address_space
741 static inline struct page *grab_cache_page_nowait(struct address_space *mapping, in grab_cache_page_nowait() argument
744 return pagecache_get_page(mapping, index, in grab_cache_page_nowait()
746 mapping_gfp_mask(mapping)); in grab_cache_page_nowait()
829 unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start,
831 unsigned filemap_get_folios_contig(struct address_space *mapping,
833 unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
836 struct page *grab_cache_page_write_begin(struct address_space *mapping,
842 static inline struct page *grab_cache_page(struct address_space *mapping, in grab_cache_page() argument
845 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); in grab_cache_page()
854 extern struct page * read_cache_page_gfp(struct address_space *mapping,
857 static inline struct page *read_mapping_page(struct address_space *mapping, in read_mapping_page() argument
860 return read_cache_page(mapping, index, NULL, file); in read_mapping_page()
863 static inline struct folio *read_mapping_folio(struct address_space *mapping, in read_mapping_folio() argument
866 return read_cache_folio(mapping, index, NULL, file); in read_mapping_folio()
1024 * is sufficient to keep folio->mapping stable.
1141 struct address_space *mapping, int warn) in __set_page_dirty() argument
1143 __folio_mark_dirty(page_folio(page), mapping, warn); in __set_page_dirty()
1157 bool noop_dirty_folio(struct address_space *mapping, struct folio *folio);
1160 int filemap_migrate_folio(struct address_space *mapping, struct folio *dst,
1182 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
1184 int filemap_add_folio(struct address_space *mapping, struct folio *folio,
1189 void delete_from_page_cache_batch(struct address_space *mapping,
1196 int __filemap_add_folio(struct address_space *mapping, struct folio *folio,
1199 bool filemap_range_has_writeback(struct address_space *mapping,
1204 * @mapping: address space within which to check
1216 static inline bool filemap_range_needs_writeback(struct address_space *mapping, in filemap_range_needs_writeback() argument
1220 if (!mapping->nrpages) in filemap_range_needs_writeback()
1222 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) && in filemap_range_needs_writeback()
1223 !mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) in filemap_range_needs_writeback()
1225 return filemap_range_has_writeback(mapping, start_byte, end_byte); in filemap_range_needs_writeback()
1241 * @mapping: Readahead this filesystem object.
1246 struct address_space *mapping; member
1259 .mapping = m, \
1276 * @mapping: address_space which holds the pagecache and I/O vectors
1288 void page_cache_sync_readahead(struct address_space *mapping, in page_cache_sync_readahead() argument
1292 DEFINE_READAHEAD(ractl, file, ra, mapping, index); in page_cache_sync_readahead()
1298 * @mapping: address_space which holds the pagecache and I/O vectors
1311 void page_cache_async_readahead(struct address_space *mapping, in page_cache_async_readahead() argument
1315 DEFINE_READAHEAD(ractl, file, ra, mapping, index); in page_cache_async_readahead()
1332 folio = xa_load(&ractl->mapping->i_pages, ractl->_index); in __readahead_folio()
1376 XA_STATE(xas, &rac->mapping->i_pages, 0); in __readahead_batch()
1481 if (!folio->mapping) in folio_mkwrite_check_truncate()
1509 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()