Lines Matching full:mapping
129 struct address_space *mapping) in mapping_set_update() argument
131 if (dax_mapping(mapping) || shmem_mapping(mapping)) in mapping_set_update()
137 static void page_cache_delete(struct address_space *mapping, in page_cache_delete() argument
140 XA_STATE(xas, &mapping->i_pages, folio->index); in page_cache_delete()
143 mapping_set_update(&xas, mapping); in page_cache_delete()
153 folio->mapping = NULL; in page_cache_delete()
155 mapping->nrpages -= nr; in page_cache_delete()
158 static void filemap_unaccount_folio(struct address_space *mapping, in filemap_unaccount_folio() argument
171 if (mapping_exiting(mapping) && !folio_test_large(folio)) { in filemap_unaccount_folio()
200 filemap_nr_thps_dec(mapping); in filemap_unaccount_folio()
218 mapping_can_writeback(mapping))) in filemap_unaccount_folio()
219 folio_account_cleaned(folio, inode_to_wb(mapping->host)); in filemap_unaccount_folio()
229 struct address_space *mapping = folio->mapping; in __filemap_remove_folio() local
232 filemap_unaccount_folio(mapping, folio); in __filemap_remove_folio()
233 page_cache_delete(mapping, folio, shadow); in __filemap_remove_folio()
236 void filemap_free_folio(struct address_space *mapping, struct folio *folio) in filemap_free_folio() argument
241 free_folio = mapping->a_ops->free_folio; in filemap_free_folio()
260 struct address_space *mapping = folio->mapping; in filemap_remove_folio() local
263 spin_lock(&mapping->host->i_lock); in filemap_remove_folio()
264 xa_lock_irq(&mapping->i_pages); in filemap_remove_folio()
266 xa_unlock_irq(&mapping->i_pages); in filemap_remove_folio()
267 if (mapping_shrinkable(mapping)) in filemap_remove_folio()
268 inode_add_lru(mapping->host); in filemap_remove_folio()
269 spin_unlock(&mapping->host->i_lock); in filemap_remove_folio()
271 filemap_free_folio(mapping, folio); in filemap_remove_folio()
276 * @mapping: the mapping to which folios belong
279 * The function walks over mapping->i_pages and removes folios passed in
280 * @fbatch from the mapping. The function expects @fbatch to be sorted
282 * It tolerates holes in @fbatch (mapping entries at those indices are not
287 static void page_cache_delete_batch(struct address_space *mapping, in page_cache_delete_batch() argument
290 XA_STATE(xas, &mapping->i_pages, fbatch->folios[0]->index); in page_cache_delete_batch()
295 mapping_set_update(&xas, mapping); in page_cache_delete_batch()
318 folio->mapping = NULL; in page_cache_delete_batch()
325 mapping->nrpages -= total_pages; in page_cache_delete_batch()
328 void delete_from_page_cache_batch(struct address_space *mapping, in delete_from_page_cache_batch() argument
336 spin_lock(&mapping->host->i_lock); in delete_from_page_cache_batch()
337 xa_lock_irq(&mapping->i_pages); in delete_from_page_cache_batch()
342 filemap_unaccount_folio(mapping, folio); in delete_from_page_cache_batch()
344 page_cache_delete_batch(mapping, fbatch); in delete_from_page_cache_batch()
345 xa_unlock_irq(&mapping->i_pages); in delete_from_page_cache_batch()
346 if (mapping_shrinkable(mapping)) in delete_from_page_cache_batch()
347 inode_add_lru(mapping->host); in delete_from_page_cache_batch()
348 spin_unlock(&mapping->host->i_lock); in delete_from_page_cache_batch()
351 filemap_free_folio(mapping, fbatch->folios[i]); in delete_from_page_cache_batch()
354 int filemap_check_errors(struct address_space *mapping) in filemap_check_errors() argument
358 if (test_bit(AS_ENOSPC, &mapping->flags) && in filemap_check_errors()
359 test_and_clear_bit(AS_ENOSPC, &mapping->flags)) in filemap_check_errors()
361 if (test_bit(AS_EIO, &mapping->flags) && in filemap_check_errors()
362 test_and_clear_bit(AS_EIO, &mapping->flags)) in filemap_check_errors()
368 static int filemap_check_and_keep_errors(struct address_space *mapping) in filemap_check_and_keep_errors() argument
371 if (test_bit(AS_EIO, &mapping->flags)) in filemap_check_and_keep_errors()
373 if (test_bit(AS_ENOSPC, &mapping->flags)) in filemap_check_and_keep_errors()
379 * filemap_fdatawrite_wbc - start writeback on mapping dirty pages in range
380 * @mapping: address space structure to write
383 * Call writepages on the mapping using the provided wbc to control the
388 int filemap_fdatawrite_wbc(struct address_space *mapping, in filemap_fdatawrite_wbc() argument
393 if (!mapping_can_writeback(mapping) || in filemap_fdatawrite_wbc()
394 !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) in filemap_fdatawrite_wbc()
397 wbc_attach_fdatawrite_inode(wbc, mapping->host); in filemap_fdatawrite_wbc()
398 ret = do_writepages(mapping, wbc); in filemap_fdatawrite_wbc()
405 * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range
406 * @mapping: address space structure to write
411 * Start writeback against all of a mapping's dirty pages that lie
421 int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, in __filemap_fdatawrite_range() argument
431 return filemap_fdatawrite_wbc(mapping, &wbc); in __filemap_fdatawrite_range()
434 static inline int __filemap_fdatawrite(struct address_space *mapping, in __filemap_fdatawrite() argument
437 return __filemap_fdatawrite_range(mapping, 0, LLONG_MAX, sync_mode); in __filemap_fdatawrite()
440 int filemap_fdatawrite(struct address_space *mapping) in filemap_fdatawrite() argument
442 return __filemap_fdatawrite(mapping, WB_SYNC_ALL); in filemap_fdatawrite()
446 int filemap_fdatawrite_range(struct address_space *mapping, loff_t start, in filemap_fdatawrite_range() argument
449 return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL); in filemap_fdatawrite_range()
455 * @mapping: target address_space
462 int filemap_flush(struct address_space *mapping) in filemap_flush() argument
464 return __filemap_fdatawrite(mapping, WB_SYNC_NONE); in filemap_flush()
470 * @mapping: address space within which to check
480 bool filemap_range_has_page(struct address_space *mapping, in filemap_range_has_page() argument
484 XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT); in filemap_range_has_page()
511 static void __filemap_fdatawait_range(struct address_space *mapping, in __filemap_fdatawait_range() argument
524 nr_folios = filemap_get_folios_tag(mapping, &index, end, in __filemap_fdatawait_range()
542 * @mapping: address space structure to wait for
556 int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, in filemap_fdatawait_range() argument
559 __filemap_fdatawait_range(mapping, start_byte, end_byte); in filemap_fdatawait_range()
560 return filemap_check_errors(mapping); in filemap_fdatawait_range()
566 * @mapping: address space structure to wait for
578 int filemap_fdatawait_range_keep_errors(struct address_space *mapping, in filemap_fdatawait_range_keep_errors() argument
581 __filemap_fdatawait_range(mapping, start_byte, end_byte); in filemap_fdatawait_range_keep_errors()
582 return filemap_check_and_keep_errors(mapping); in filemap_fdatawait_range_keep_errors()
604 struct address_space *mapping = file->f_mapping; in file_fdatawait_range() local
606 __filemap_fdatawait_range(mapping, start_byte, end_byte); in file_fdatawait_range()
613 * @mapping: address space structure to wait for
625 int filemap_fdatawait_keep_errors(struct address_space *mapping) in filemap_fdatawait_keep_errors() argument
627 __filemap_fdatawait_range(mapping, 0, LLONG_MAX); in filemap_fdatawait_keep_errors()
628 return filemap_check_and_keep_errors(mapping); in filemap_fdatawait_keep_errors()
633 static bool mapping_needs_writeback(struct address_space *mapping) in mapping_needs_writeback() argument
635 return mapping->nrpages; in mapping_needs_writeback()
638 bool filemap_range_has_writeback(struct address_space *mapping, in filemap_range_has_writeback() argument
641 XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT); in filemap_range_has_writeback()
665 * @mapping: the address_space for the pages
676 int filemap_write_and_wait_range(struct address_space *mapping, in filemap_write_and_wait_range() argument
684 if (mapping_needs_writeback(mapping)) { in filemap_write_and_wait_range()
685 err = __filemap_fdatawrite_range(mapping, lstart, lend, in filemap_write_and_wait_range()
694 __filemap_fdatawait_range(mapping, lstart, lend); in filemap_write_and_wait_range()
696 err2 = filemap_check_errors(mapping); in filemap_write_and_wait_range()
703 void __filemap_set_wb_err(struct address_space *mapping, int err) in __filemap_set_wb_err() argument
705 errseq_t eseq = errseq_set(&mapping->wb_err, err); in __filemap_set_wb_err()
707 trace_filemap_set_wb_err(mapping, eseq); in __filemap_set_wb_err()
720 * Grab the wb_err from the mapping. If it matches what we have in the file,
723 * If it doesn't match, then take the mapping value, set the "seen" flag in
729 * While we handle mapping->wb_err with atomic operations, the f_wb_err
739 struct address_space *mapping = file->f_mapping; in file_check_and_advance_wb_err() local
742 if (errseq_check(&mapping->wb_err, old)) { in file_check_and_advance_wb_err()
746 err = errseq_check_and_advance(&mapping->wb_err, in file_check_and_advance_wb_err()
757 clear_bit(AS_EIO, &mapping->flags); in file_check_and_advance_wb_err()
758 clear_bit(AS_ENOSPC, &mapping->flags); in file_check_and_advance_wb_err()
782 struct address_space *mapping = file->f_mapping; in file_write_and_wait_range() local
787 if (mapping_needs_writeback(mapping)) { in file_write_and_wait_range()
788 err = __filemap_fdatawrite_range(mapping, lstart, lend, in file_write_and_wait_range()
792 __filemap_fdatawait_range(mapping, lstart, lend); in file_write_and_wait_range()
816 struct address_space *mapping = old->mapping; in replace_page_cache_folio() local
817 void (*free_folio)(struct folio *) = mapping->a_ops->free_folio; in replace_page_cache_folio()
819 XA_STATE(xas, &mapping->i_pages, offset); in replace_page_cache_folio()
823 VM_BUG_ON_FOLIO(new->mapping, new); in replace_page_cache_folio()
826 new->mapping = mapping; in replace_page_cache_folio()
834 old->mapping = NULL; in replace_page_cache_folio()
851 noinline int __filemap_add_folio(struct address_space *mapping, in __filemap_add_folio() argument
854 XA_STATE(xas, &mapping->i_pages, index); in __filemap_add_folio()
862 VM_BUG_ON_FOLIO(folio_order(folio) < mapping_min_folio_order(mapping), in __filemap_add_folio()
864 mapping_set_update(&xas, mapping); in __filemap_add_folio()
873 folio->mapping = mapping; in __filemap_add_folio()
904 BUG_ON(shmem_mapping(mapping)); in __filemap_add_folio()
920 mapping->nrpages += nr; in __filemap_add_folio()
954 folio->mapping = NULL; in __filemap_add_folio()
961 int filemap_add_folio(struct address_space *mapping, struct folio *folio, in filemap_add_folio() argument
972 ret = __filemap_add_folio(mapping, folio, index, gfp, &shadow); in filemap_add_folio()
1018 * Lock exclusively invalidate_lock of any passed mapping that is not NULL.
1020 * @mapping1: the first mapping to lock
1021 * @mapping2: the second mapping to lock
1038 * Unlock exclusive invalidate_lock of any passed mapping that is not NULL.
1040 * @mapping1: the first mapping to unlock
1041 * @mapping2: the second mapping to unlock
1732 * @mapping: Mapping.
1749 pgoff_t page_cache_next_miss(struct address_space *mapping, in page_cache_next_miss() argument
1752 XA_STATE(xas, &mapping->i_pages, index); in page_cache_next_miss()
1768 * @mapping: Mapping.
1785 pgoff_t page_cache_prev_miss(struct address_space *mapping, in page_cache_prev_miss() argument
1788 XA_STATE(xas, &mapping->i_pages, index); in page_cache_prev_miss()
1824 * @mapping: the address_space to search
1827 * Looks up the page cache entry at @mapping & @index. If it is a folio,
1834 void *filemap_get_entry(struct address_space *mapping, pgoff_t index) in filemap_get_entry() argument
1836 XA_STATE(xas, &mapping->i_pages, index); in filemap_get_entry()
1867 * @mapping: The address_space to search.
1872 * Looks up the page cache entry at @mapping & @index.
1881 struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, in __filemap_get_folio() argument
1887 folio = filemap_get_entry(mapping, index); in __filemap_get_folio()
1904 if (unlikely(folio->mapping != mapping)) { in __filemap_get_folio()
1924 unsigned int min_order = mapping_min_folio_order(mapping); in __filemap_get_folio()
1927 index = mapping_align_index(mapping, index); in __filemap_get_folio()
1929 if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping)) in __filemap_get_folio()
1940 if (order > mapping_max_folio_order(mapping)) in __filemap_get_folio()
1941 order = mapping_max_folio_order(mapping); in __filemap_get_folio()
1960 err = filemap_add_folio(mapping, folio, index, gfp); in __filemap_get_folio()
2022 * @mapping: The address_space to search
2029 * the mapping. The entries are placed in @fbatch. find_get_entries()
2040 unsigned find_get_entries(struct address_space *mapping, pgoff_t *start, in find_get_entries() argument
2043 XA_STATE(xas, &mapping->i_pages, *start); in find_get_entries()
2061 nr = 1 << xa_get_order(&mapping->i_pages, indices[idx]); in find_get_entries()
2071 * @mapping: The address_space to search.
2077 * find_lock_entries() will return a batch of entries from @mapping.
2089 unsigned find_lock_entries(struct address_space *mapping, pgoff_t *start, in find_lock_entries() argument
2092 XA_STATE(xas, &mapping->i_pages, *start); in find_lock_entries()
2111 if (folio->mapping != mapping || in find_lock_entries()
2145 * @mapping: The address_space to search
2150 * Search for and return a batch of folios in the mapping starting at
2157 unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, in filemap_get_folios() argument
2160 return filemap_get_folios_tag(mapping, start, end, XA_PRESENT, fbatch); in filemap_get_folios()
2166 * @mapping: The address_space to search
2179 unsigned filemap_get_folios_contig(struct address_space *mapping, in filemap_get_folios_contig() argument
2182 XA_STATE(xas, &mapping->i_pages, *start); in filemap_get_folios_contig()
2237 * @mapping: The address_space to search
2254 unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, in filemap_get_folios_tag() argument
2257 XA_STATE(xas, &mapping->i_pages, *start); in filemap_get_folios_tag()
2321 static void filemap_get_read_batch(struct address_space *mapping, in filemap_get_read_batch() argument
2324 XA_STATE(xas, &mapping->i_pages, index); in filemap_get_read_batch()
2383 static bool filemap_range_uptodate(struct address_space *mapping, in filemap_range_uptodate() argument
2392 if (!mapping->a_ops->is_partially_uptodate) in filemap_range_uptodate()
2394 if (mapping->host->i_blkbits >= folio_shift(folio)) in filemap_range_uptodate()
2404 return mapping->a_ops->is_partially_uptodate(folio, pos, count); in filemap_range_uptodate()
2408 struct address_space *mapping, size_t count, in filemap_update_page() argument
2414 if (!filemap_invalidate_trylock_shared(mapping)) in filemap_update_page()
2417 filemap_invalidate_lock_shared(mapping); in filemap_update_page()
2425 filemap_invalidate_unlock_shared(mapping); in filemap_update_page()
2439 if (!folio->mapping) in filemap_update_page()
2443 if (filemap_range_uptodate(mapping, iocb->ki_pos, count, folio, in filemap_update_page()
2451 error = filemap_read_folio(iocb->ki_filp, mapping->a_ops->read_folio, in filemap_update_page()
2457 filemap_invalidate_unlock_shared(mapping); in filemap_update_page()
2464 struct address_space *mapping, loff_t pos, in filemap_create_folio() argument
2469 unsigned int min_order = mapping_min_folio_order(mapping); in filemap_create_folio()
2472 folio = filemap_alloc_folio(mapping_gfp_mask(mapping), min_order); in filemap_create_folio()
2486 * while mapping blocks for IO so let's hold the lock here as in filemap_create_folio()
2489 filemap_invalidate_lock_shared(mapping); in filemap_create_folio()
2491 error = filemap_add_folio(mapping, folio, index, in filemap_create_folio()
2492 mapping_gfp_constraint(mapping, GFP_KERNEL)); in filemap_create_folio()
2498 error = filemap_read_folio(file, mapping->a_ops->read_folio, folio); in filemap_create_folio()
2502 filemap_invalidate_unlock_shared(mapping); in filemap_create_folio()
2506 filemap_invalidate_unlock_shared(mapping); in filemap_create_folio()
2512 struct address_space *mapping, struct folio *folio, in filemap_readahead() argument
2515 DEFINE_READAHEAD(ractl, file, &file->f_ra, mapping, folio->index); in filemap_readahead()
2527 struct address_space *mapping = filp->f_mapping; in filemap_get_pages() local
2541 filemap_get_read_batch(mapping, index, last_index - 1, fbatch); in filemap_get_pages()
2547 page_cache_sync_readahead(mapping, ra, filp, index, in filemap_get_pages()
2551 filemap_get_read_batch(mapping, index, last_index - 1, fbatch); in filemap_get_pages()
2556 err = filemap_create_folio(filp, mapping, iocb->ki_pos, fbatch); in filemap_get_pages()
2564 err = filemap_readahead(iocb, filp, mapping, folio, last_index); in filemap_get_pages()
2572 err = filemap_update_page(iocb, mapping, count, folio, in filemap_get_pages()
2578 trace_mm_filemap_get_pages(mapping, index, last_index - 1); in filemap_get_pages()
2615 struct address_space *mapping = filp->f_mapping; in filemap_read() local
2616 struct inode *inode = mapping->host; in filemap_read()
2666 writably_mapped = mapping_writably_mapped(mapping); in filemap_read()
2721 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_write_and_wait() local
2726 if (filemap_range_needs_writeback(mapping, pos, end)) in kiocb_write_and_wait()
2731 return filemap_write_and_wait_range(mapping, pos, end); in kiocb_write_and_wait()
2735 int filemap_invalidate_pages(struct address_space *mapping, in filemap_invalidate_pages() argument
2742 if (filemap_range_has_page(mapping, pos, end)) in filemap_invalidate_pages()
2745 ret = filemap_write_and_wait_range(mapping, pos, end); in filemap_invalidate_pages()
2756 return invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT, in filemap_invalidate_pages()
2762 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_invalidate_pages() local
2764 return filemap_invalidate_pages(mapping, iocb->ki_pos, in kiocb_invalidate_pages()
2802 struct address_space *mapping = file->f_mapping; in generic_file_read_iter() local
2803 struct inode *inode = mapping->host; in generic_file_read_iter()
2810 retval = mapping->a_ops->direct_IO(iocb, iter); in generic_file_read_iter()
2984 struct address_space *mapping, struct folio *folio, in folio_seek_hole_data() argument
2987 const struct address_space_operations *ops = mapping->a_ops; in folio_seek_hole_data()
2988 size_t offset, bsz = i_blocksize(mapping->host); in folio_seek_hole_data()
2998 if (unlikely(folio->mapping != mapping)) in folio_seek_hole_data()
3025 * @mapping: Address space to search.
3041 loff_t mapping_seek_hole_data(struct address_space *mapping, loff_t start, in mapping_seek_hole_data() argument
3044 XA_STATE(xas, &mapping->i_pages, start >> PAGE_SHIFT); in mapping_seek_hole_data()
3065 start = folio_seek_hole_data(&xas, mapping, folio, start, pos, in mapping_seek_hole_data()
3146 struct address_space *mapping = file->f_mapping; in do_sync_mmap_readahead() local
3147 DEFINE_READAHEAD(ractl, file, ra, mapping, vmf->pgoff); in do_sync_mmap_readahead()
3306 struct address_space *mapping = file->f_mapping; in filemap_fault() local
3307 struct inode *inode = mapping->host; in filemap_fault()
3317 trace_mm_filemap_fault(mapping, index); in filemap_fault()
3322 folio = filemap_get_folio(mapping, index); in filemap_fault()
3331 filemap_invalidate_lock_shared(mapping); in filemap_fault()
3350 filemap_invalidate_lock_shared(mapping); in filemap_fault()
3353 folio = __filemap_get_folio(mapping, index, in filemap_fault()
3359 filemap_invalidate_unlock_shared(mapping); in filemap_fault()
3368 if (unlikely(folio->mapping != mapping)) { in filemap_fault()
3411 filemap_invalidate_unlock_shared(mapping); in filemap_fault()
3435 error = filemap_read_folio(file, mapping->a_ops->read_folio, folio); in filemap_fault()
3442 filemap_invalidate_unlock_shared(mapping); in filemap_fault()
3455 filemap_invalidate_unlock_shared(mapping); in filemap_fault()
3491 struct address_space *mapping, pgoff_t end_pgoff) in next_uptodate_folio() argument
3514 if (folio->mapping != mapping) in next_uptodate_folio()
3518 max_idx = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE); in next_uptodate_folio()
3635 struct address_space *mapping = file->f_mapping; in filemap_map_pages() local
3638 XA_STATE(xas, &mapping->i_pages, start_pgoff); in filemap_map_pages()
3645 folio = next_uptodate_folio(&xas, mapping, end_pgoff); in filemap_map_pages()
3662 file_end = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE) - 1; in filemap_map_pages()
3686 } while ((folio = next_uptodate_folio(&xas, mapping, end_pgoff)) != NULL); in filemap_map_pages()
3689 trace_mm_filemap_map_pages(mapping, start_pgoff, end_pgoff); in filemap_map_pages()
3705 struct address_space *mapping = vmf->vma->vm_file->f_mapping; in filemap_page_mkwrite() local
3709 sb_start_pagefault(mapping->host->i_sb); in filemap_page_mkwrite()
3712 if (folio->mapping != mapping) { in filemap_page_mkwrite()
3725 sb_end_pagefault(mapping->host->i_sb); in filemap_page_mkwrite()
3739 struct address_space *mapping = file->f_mapping; in generic_file_mmap() local
3741 if (!mapping->a_ops->read_folio) in generic_file_mmap()
3776 static struct folio *do_read_cache_folio(struct address_space *mapping, in do_read_cache_folio() argument
3783 filler = mapping->a_ops->read_folio; in do_read_cache_folio()
3785 folio = filemap_get_folio(mapping, index); in do_read_cache_folio()
3788 mapping_min_folio_order(mapping)); in do_read_cache_folio()
3791 index = mapping_align_index(mapping, index); in do_read_cache_folio()
3792 err = filemap_add_folio(mapping, folio, index, gfp); in do_read_cache_folio()
3811 /* Folio was truncated from mapping */ in do_read_cache_folio()
3812 if (!folio->mapping) { in do_read_cache_folio()
3840 * @mapping: The address_space to read from.
3851 * Context: May sleep. Expects mapping->invalidate_lock to be held.
3854 struct folio *read_cache_folio(struct address_space *mapping, pgoff_t index, in read_cache_folio() argument
3857 return do_read_cache_folio(mapping, index, filler, file, in read_cache_folio()
3858 mapping_gfp_mask(mapping)); in read_cache_folio()
3864 * @mapping: The address_space for the folio.
3868 * This is the same as "read_cache_folio(mapping, index, NULL, NULL)", but with
3875 * The function expects mapping->invalidate_lock to be already held.
3879 struct folio *mapping_read_folio_gfp(struct address_space *mapping, in mapping_read_folio_gfp() argument
3882 return do_read_cache_folio(mapping, index, NULL, NULL, gfp); in mapping_read_folio_gfp()
3886 static struct page *do_read_cache_page(struct address_space *mapping, in do_read_cache_page() argument
3891 folio = do_read_cache_folio(mapping, index, filler, file, gfp); in do_read_cache_page()
3897 struct page *read_cache_page(struct address_space *mapping, in read_cache_page() argument
3900 return do_read_cache_page(mapping, index, filler, file, in read_cache_page()
3901 mapping_gfp_mask(mapping)); in read_cache_page()
3907 * @mapping: the page's address_space
3911 * This is the same as "read_mapping_page(mapping, index, NULL)", but with
3916 * The function expects mapping->invalidate_lock to be already held.
3920 struct page *read_cache_page_gfp(struct address_space *mapping, in read_cache_page_gfp() argument
3924 return do_read_cache_page(mapping, index, NULL, NULL, gfp); in read_cache_page_gfp()
3950 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_invalidate_post_direct_write() local
3952 if (mapping->nrpages && in kiocb_invalidate_post_direct_write()
3953 invalidate_inode_pages2_range(mapping, in kiocb_invalidate_post_direct_write()
3962 struct address_space *mapping = iocb->ki_filp->f_mapping; in generic_file_direct_write() local
3977 written = mapping->a_ops->direct_IO(iocb, from); in generic_file_direct_write()
3994 * Skip invalidation for async writes or if mapping has no pages. in generic_file_direct_write()
3997 struct inode *inode = mapping->host; in generic_file_direct_write()
4019 struct address_space *mapping = file->f_mapping; in generic_perform_write() local
4020 const struct address_space_operations *a_ops = mapping->a_ops; in generic_perform_write()
4021 size_t chunk = mapping_max_folio_size(mapping); in generic_perform_write()
4036 balance_dirty_pages_ratelimited(mapping); in generic_perform_write()
4054 status = a_ops->write_begin(file, mapping, pos, bytes, in generic_perform_write()
4063 if (mapping_writably_mapped(mapping)) in generic_perform_write()
4069 status = a_ops->write_end(file, mapping, pos, bytes, copied, in generic_perform_write()
4128 struct address_space *mapping = file->f_mapping; in __generic_file_write_iter() local
4129 struct inode *inode = mapping->host; in __generic_file_write_iter()
4209 struct address_space * const mapping = folio->mapping; in filemap_release_folio() local
4217 if (mapping && mapping->a_ops->release_folio) in filemap_release_folio()
4218 return mapping->a_ops->release_folio(folio, gfp); in filemap_release_folio()
4239 struct address_space *mapping = inode->i_mapping; in filemap_invalidate_inode() local
4244 if (!mapping || !mapping->nrpages || end < start) in filemap_invalidate_inode()
4248 filemap_invalidate_lock(mapping); in filemap_invalidate_inode()
4250 if (!mapping->nrpages) in filemap_invalidate_inode()
4253 unmap_mapping_pages(mapping, first, nr, false); in filemap_invalidate_inode()
4264 filemap_fdatawrite_wbc(mapping, &wbc); in filemap_invalidate_inode()
4268 invalidate_inode_pages2_range(mapping, start / PAGE_SIZE, end / PAGE_SIZE); in filemap_invalidate_inode()
4271 filemap_invalidate_unlock(mapping); in filemap_invalidate_inode()
4273 return filemap_check_errors(mapping); in filemap_invalidate_inode()
4279 * filemap_cachestat() - compute the page cache statistics of a mapping
4280 * @mapping: The mapping to compute the statistics for.
4285 * This will query the page cache statistics of a mapping in the
4290 static void filemap_cachestat(struct address_space *mapping, in filemap_cachestat() argument
4293 XA_STATE(xas, &mapping->i_pages, first_index); in filemap_cachestat()
4339 if (shmem_mapping(mapping)) { in filemap_cachestat()
4425 struct address_space *mapping; in SYSCALL_DEFINE4() local
4454 mapping = fd_file(f)->f_mapping; in SYSCALL_DEFINE4()
4455 filemap_cachestat(mapping, first_index, last_index, &cs); in SYSCALL_DEFINE4()