Lines Matching refs: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,
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()
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()
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()
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()
143 static inline bool mapping_empty(struct address_space *mapping) in mapping_empty() argument
145 return xa_empty(&mapping->i_pages); in mapping_empty()
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()
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()
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()
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()
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()
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()
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()
497 return mapping_max_folio_order(mapping) > 0; in mapping_large_folio_support()
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()
555 return folio->mapping; in folio_file_mapping()
594 return folio->mapping->host; in folio_inode()
687 pgoff_t page_cache_next_miss(struct address_space *mapping,
689 pgoff_t page_cache_prev_miss(struct address_space *mapping,
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,
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()
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()
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()
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()
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()
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()
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()
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()
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,
1297 int __filemap_add_folio(struct address_space *mapping, struct folio *folio,
1300 bool filemap_range_has_writeback(struct address_space *mapping,
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()
1347 struct address_space *mapping; member
1360 .mapping = m, \
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()
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()
1432 folio = xa_load(&ractl->mapping->i_pages, ractl->_index); in __readahead_folio()
1476 XA_STATE(xas, &rac->mapping->i_pages, 0); in __readahead_batch()
1581 if (!folio->mapping) in folio_mkwrite_check_truncate()
1609 if (page->mapping != inode->i_mapping) in page_mkwrite_check_truncate()