• Home
  • Raw
  • Download

Lines Matching refs:mapping

120 static void page_cache_delete(struct address_space *mapping,  in page_cache_delete()  argument
123 XA_STATE(xas, &mapping->i_pages, page->index); in page_cache_delete()
126 mapping_set_update(&xas, mapping); in page_cache_delete()
141 page->mapping = NULL; in page_cache_delete()
145 mapping->nrexceptional += nr; in page_cache_delete()
154 mapping->nrpages -= nr; in page_cache_delete()
157 static void unaccount_page_cache_page(struct address_space *mapping, in unaccount_page_cache_page() argument
170 cleancache_invalidate_page(mapping, page); in unaccount_page_cache_page()
184 if (mapping_exiting(mapping) && in unaccount_page_cache_page()
210 filemap_nr_thps_dec(mapping); in unaccount_page_cache_page()
224 account_page_cleaned(page, mapping, inode_to_wb(mapping->host)); in unaccount_page_cache_page()
234 struct address_space *mapping = page->mapping; in __delete_from_page_cache() local
238 unaccount_page_cache_page(mapping, page); in __delete_from_page_cache()
239 page_cache_delete(mapping, page, shadow); in __delete_from_page_cache()
242 static void page_cache_free_page(struct address_space *mapping, in page_cache_free_page() argument
247 freepage = mapping->a_ops->freepage; in page_cache_free_page()
269 struct address_space *mapping = page_mapping(page); in delete_from_page_cache() local
273 xa_lock_irqsave(&mapping->i_pages, flags); in delete_from_page_cache()
275 xa_unlock_irqrestore(&mapping->i_pages, flags); in delete_from_page_cache()
277 page_cache_free_page(mapping, page); in delete_from_page_cache()
295 static void page_cache_delete_batch(struct address_space *mapping, in page_cache_delete_batch() argument
298 XA_STATE(xas, &mapping->i_pages, pvec->pages[0]->index); in page_cache_delete_batch()
303 mapping_set_update(&xas, mapping); in page_cache_delete_batch()
327 page->mapping = NULL; in page_cache_delete_batch()
340 mapping->nrpages -= total_pages; in page_cache_delete_batch()
343 void delete_from_page_cache_batch(struct address_space *mapping, in delete_from_page_cache_batch() argument
352 xa_lock_irqsave(&mapping->i_pages, flags); in delete_from_page_cache_batch()
356 unaccount_page_cache_page(mapping, pvec->pages[i]); in delete_from_page_cache_batch()
358 page_cache_delete_batch(mapping, pvec); in delete_from_page_cache_batch()
359 xa_unlock_irqrestore(&mapping->i_pages, flags); in delete_from_page_cache_batch()
362 page_cache_free_page(mapping, pvec->pages[i]); in delete_from_page_cache_batch()
365 int filemap_check_errors(struct address_space *mapping) in filemap_check_errors() argument
369 if (test_bit(AS_ENOSPC, &mapping->flags) && in filemap_check_errors()
370 test_and_clear_bit(AS_ENOSPC, &mapping->flags)) in filemap_check_errors()
372 if (test_bit(AS_EIO, &mapping->flags) && in filemap_check_errors()
373 test_and_clear_bit(AS_EIO, &mapping->flags)) in filemap_check_errors()
379 static int filemap_check_and_keep_errors(struct address_space *mapping) in filemap_check_and_keep_errors() argument
382 if (test_bit(AS_EIO, &mapping->flags)) in filemap_check_and_keep_errors()
384 if (test_bit(AS_ENOSPC, &mapping->flags)) in filemap_check_and_keep_errors()
406 int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, in __filemap_fdatawrite_range() argument
417 if (!mapping_can_writeback(mapping) || in __filemap_fdatawrite_range()
418 !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) in __filemap_fdatawrite_range()
421 wbc_attach_fdatawrite_inode(&wbc, mapping->host); in __filemap_fdatawrite_range()
422 ret = do_writepages(mapping, &wbc); in __filemap_fdatawrite_range()
427 static inline int __filemap_fdatawrite(struct address_space *mapping, in __filemap_fdatawrite() argument
430 return __filemap_fdatawrite_range(mapping, 0, LLONG_MAX, sync_mode); in __filemap_fdatawrite()
433 int filemap_fdatawrite(struct address_space *mapping) in filemap_fdatawrite() argument
435 return __filemap_fdatawrite(mapping, WB_SYNC_ALL); in filemap_fdatawrite()
439 int filemap_fdatawrite_range(struct address_space *mapping, loff_t start, in filemap_fdatawrite_range() argument
442 return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL); in filemap_fdatawrite_range()
455 int filemap_flush(struct address_space *mapping) in filemap_flush() argument
457 return __filemap_fdatawrite(mapping, WB_SYNC_NONE); in filemap_flush()
473 bool filemap_range_has_page(struct address_space *mapping, in filemap_range_has_page() argument
477 XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT); in filemap_range_has_page()
504 static void __filemap_fdatawait_range(struct address_space *mapping, in __filemap_fdatawait_range() argument
519 nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, in __filemap_fdatawait_range()
551 int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, in filemap_fdatawait_range() argument
554 __filemap_fdatawait_range(mapping, start_byte, end_byte); in filemap_fdatawait_range()
555 return filemap_check_errors(mapping); in filemap_fdatawait_range()
573 int filemap_fdatawait_range_keep_errors(struct address_space *mapping, in filemap_fdatawait_range_keep_errors() argument
576 __filemap_fdatawait_range(mapping, start_byte, end_byte); in filemap_fdatawait_range_keep_errors()
577 return filemap_check_and_keep_errors(mapping); in filemap_fdatawait_range_keep_errors()
599 struct address_space *mapping = file->f_mapping; in file_fdatawait_range() local
601 __filemap_fdatawait_range(mapping, start_byte, end_byte); in file_fdatawait_range()
620 int filemap_fdatawait_keep_errors(struct address_space *mapping) in filemap_fdatawait_keep_errors() argument
622 __filemap_fdatawait_range(mapping, 0, LLONG_MAX); in filemap_fdatawait_keep_errors()
623 return filemap_check_and_keep_errors(mapping); in filemap_fdatawait_keep_errors()
628 static bool mapping_needs_writeback(struct address_space *mapping) in mapping_needs_writeback() argument
630 if (dax_mapping(mapping)) in mapping_needs_writeback()
631 return mapping->nrexceptional; in mapping_needs_writeback()
633 return mapping->nrpages; in mapping_needs_writeback()
649 int filemap_write_and_wait_range(struct address_space *mapping, in filemap_write_and_wait_range() argument
654 if (mapping_needs_writeback(mapping)) { in filemap_write_and_wait_range()
655 err = __filemap_fdatawrite_range(mapping, lstart, lend, in filemap_write_and_wait_range()
664 int err2 = filemap_fdatawait_range(mapping, in filemap_write_and_wait_range()
670 filemap_check_errors(mapping); in filemap_write_and_wait_range()
673 err = filemap_check_errors(mapping); in filemap_write_and_wait_range()
679 void __filemap_set_wb_err(struct address_space *mapping, int err) in __filemap_set_wb_err() argument
681 errseq_t eseq = errseq_set(&mapping->wb_err, err); in __filemap_set_wb_err()
683 trace_filemap_set_wb_err(mapping, eseq); in __filemap_set_wb_err()
715 struct address_space *mapping = file->f_mapping; in file_check_and_advance_wb_err() local
718 if (errseq_check(&mapping->wb_err, old)) { in file_check_and_advance_wb_err()
722 err = errseq_check_and_advance(&mapping->wb_err, in file_check_and_advance_wb_err()
733 clear_bit(AS_EIO, &mapping->flags); in file_check_and_advance_wb_err()
734 clear_bit(AS_ENOSPC, &mapping->flags); in file_check_and_advance_wb_err()
758 struct address_space *mapping = file->f_mapping; in file_write_and_wait_range() local
760 if (mapping_needs_writeback(mapping)) { in file_write_and_wait_range()
761 err = __filemap_fdatawrite_range(mapping, lstart, lend, in file_write_and_wait_range()
765 __filemap_fdatawait_range(mapping, lstart, lend); in file_write_and_wait_range()
792 struct address_space *mapping = old->mapping; in replace_page_cache_page() local
793 void (*freepage)(struct page *) = mapping->a_ops->freepage; in replace_page_cache_page()
795 XA_STATE(xas, &mapping->i_pages, offset); in replace_page_cache_page()
800 VM_BUG_ON_PAGE(new->mapping, new); in replace_page_cache_page()
803 new->mapping = mapping; in replace_page_cache_page()
811 old->mapping = NULL; in replace_page_cache_page()
831 struct address_space *mapping, in __add_to_page_cache_locked() argument
835 XA_STATE(xas, &mapping->i_pages, offset); in __add_to_page_cache_locked()
842 mapping_set_update(&xas, mapping); in __add_to_page_cache_locked()
845 page->mapping = mapping; in __add_to_page_cache_locked()
889 mapping->nrexceptional--; in __add_to_page_cache_locked()
890 mapping->nrpages++; in __add_to_page_cache_locked()
909 page->mapping = NULL; in __add_to_page_cache_locked()
928 int add_to_page_cache_locked(struct page *page, struct address_space *mapping, in add_to_page_cache_locked() argument
931 return __add_to_page_cache_locked(page, mapping, offset, in add_to_page_cache_locked()
936 int add_to_page_cache_lru(struct page *page, struct address_space *mapping, in add_to_page_cache_lru() argument
943 ret = __add_to_page_cache_locked(page, mapping, offset, in add_to_page_cache_lru()
1523 struct address_space *mapping; in page_endio() local
1526 mapping = page_mapping(page); in page_endio()
1527 if (mapping) in page_endio()
1528 mapping_set_error(mapping, err); in page_endio()
1624 pgoff_t page_cache_next_miss(struct address_space *mapping, in page_cache_next_miss() argument
1627 XA_STATE(xas, &mapping->i_pages, index); in page_cache_next_miss()
1660 pgoff_t page_cache_prev_miss(struct address_space *mapping, in page_cache_prev_miss() argument
1663 XA_STATE(xas, &mapping->i_pages, index); in page_cache_prev_miss()
1690 struct page *find_get_entry(struct address_space *mapping, pgoff_t index) in find_get_entry() argument
1692 XA_STATE(xas, &mapping->i_pages, index); in find_get_entry()
1740 struct page *find_lock_entry(struct address_space *mapping, pgoff_t index) in find_lock_entry() argument
1745 page = find_get_entry(mapping, index); in find_lock_entry()
1749 if (unlikely(page->mapping != mapping)) { in find_lock_entry()
1791 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index, in pagecache_get_page() argument
1797 page = find_get_entry(mapping, index); in pagecache_get_page()
1814 if (unlikely(page->mapping != mapping)) { in pagecache_get_page()
1835 if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping)) in pagecache_get_page()
1851 err = add_to_page_cache_lru(page, mapping, index, gfp_mask); in pagecache_get_page()
1898 unsigned find_get_entries(struct address_space *mapping, in find_get_entries() argument
1902 XA_STATE(xas, &mapping->i_pages, start); in find_get_entries()
1972 unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start, in find_get_pages_range() argument
1976 XA_STATE(xas, &mapping->i_pages, *start); in find_get_pages_range()
2038 unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, in find_get_pages_contig() argument
2041 XA_STATE(xas, &mapping->i_pages, index); in find_get_pages_contig()
2094 unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, in find_get_pages_range_tag() argument
2098 XA_STATE(xas, &mapping->i_pages, *index); in find_get_pages_range_tag()
2193 struct address_space *mapping = filp->f_mapping; in generic_file_buffered_read() local
2194 struct inode *inode = mapping->host; in generic_file_buffered_read()
2235 page = find_get_page(mapping, index); in generic_file_buffered_read()
2239 page_cache_sync_readahead(mapping, in generic_file_buffered_read()
2242 page = find_get_page(mapping, index); in generic_file_buffered_read()
2251 page_cache_async_readahead(mapping, in generic_file_buffered_read()
2281 !mapping->a_ops->is_partially_uptodate) in generic_file_buffered_read()
2289 if (!page->mapping) in generic_file_buffered_read()
2291 if (!mapping->a_ops->is_partially_uptodate(page, in generic_file_buffered_read()
2328 if (mapping_writably_mapped(mapping)) in generic_file_buffered_read()
2376 if (!page->mapping) { in generic_file_buffered_read()
2401 error = mapping->a_ops->readpage(filp, page); in generic_file_buffered_read()
2426 if (page->mapping == NULL) { in generic_file_buffered_read()
2454 page = page_cache_alloc(mapping); in generic_file_buffered_read()
2459 error = add_to_page_cache_lru(page, mapping, index, in generic_file_buffered_read()
2460 mapping_gfp_constraint(mapping, GFP_KERNEL)); in generic_file_buffered_read()
2517 struct address_space *mapping = file->f_mapping; in generic_file_read_iter() local
2518 struct inode *inode = mapping->host; in generic_file_read_iter()
2523 if (filemap_range_has_page(mapping, iocb->ki_pos, in generic_file_read_iter()
2527 retval = filemap_write_and_wait_range(mapping, in generic_file_read_iter()
2536 retval = mapping->a_ops->direct_IO(iocb, iter); in generic_file_read_iter()
2620 struct address_space *mapping = file->f_mapping; in do_sync_mmap_readahead() local
2621 DEFINE_READAHEAD(ractl, file, mapping, vmf->pgoff); in do_sync_mmap_readahead()
2671 struct address_space *mapping = file->f_mapping; in do_async_mmap_readahead() local
2684 page_cache_async_readahead(mapping, ra, file, in do_async_mmap_readahead()
2718 struct address_space *mapping = file->f_mapping; in filemap_fault() local
2720 struct inode *inode = mapping->host; in filemap_fault()
2733 page = find_get_page(mapping, offset); in filemap_fault()
2747 page = pagecache_get_page(mapping, offset, in filemap_fault()
2761 if (unlikely(compound_head(page)->mapping != mapping)) { in filemap_fault()
2808 error = mapping->a_ops->readpage(file, page); in filemap_fault()
2842 struct address_space *mapping = file->f_mapping; in filemap_map_pages() local
2845 XA_STATE(xas, &mapping->i_pages, start_pgoff); in filemap_map_pages()
2877 if (head->mapping != mapping || !PageUptodate(head)) in filemap_map_pages()
2880 max_idx = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE); in filemap_map_pages()
2918 if (page->mapping != inode->i_mapping) { in filemap_page_mkwrite()
2945 struct address_space *mapping = file->f_mapping; in generic_file_mmap() local
2947 if (!mapping->a_ops->readpage) in generic_file_mmap()
2994 static struct page *do_read_cache_page(struct address_space *mapping, in do_read_cache_page() argument
3003 page = find_get_page(mapping, index); in do_read_cache_page()
3008 err = add_to_page_cache_lru(page, mapping, index, gfp); in do_read_cache_page()
3021 err = mapping->a_ops->readpage(data, page); in do_read_cache_page()
3075 if (!page->mapping) { in do_read_cache_page()
3115 struct page *read_cache_page(struct address_space *mapping, in read_cache_page() argument
3120 return do_read_cache_page(mapping, index, filler, data, in read_cache_page()
3121 mapping_gfp_mask(mapping)); in read_cache_page()
3138 struct page *read_cache_page_gfp(struct address_space *mapping, in read_cache_page_gfp() argument
3142 return do_read_cache_page(mapping, index, NULL, NULL, gfp); in read_cache_page_gfp()
3146 int pagecache_write_begin(struct file *file, struct address_space *mapping, in pagecache_write_begin() argument
3150 const struct address_space_operations *aops = mapping->a_ops; in pagecache_write_begin()
3152 return aops->write_begin(file, mapping, pos, len, flags, in pagecache_write_begin()
3157 int pagecache_write_end(struct file *file, struct address_space *mapping, in pagecache_write_end() argument
3161 const struct address_space_operations *aops = mapping->a_ops; in pagecache_write_end()
3163 return aops->write_end(file, mapping, pos, len, copied, page, fsdata); in pagecache_write_end()
3192 struct address_space *mapping = file->f_mapping; in generic_file_direct_write() local
3193 struct inode *inode = mapping->host; in generic_file_direct_write()
3208 written = filemap_write_and_wait_range(mapping, pos, in generic_file_direct_write()
3220 written = invalidate_inode_pages2_range(mapping, in generic_file_direct_write()
3232 written = mapping->a_ops->direct_IO(iocb, from); in generic_file_direct_write()
3251 if (written > 0 && mapping->nrpages && in generic_file_direct_write()
3252 invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT, end)) in generic_file_direct_write()
3274 struct page *grab_cache_page_write_begin(struct address_space *mapping, in grab_cache_page_write_begin() argument
3283 page = pagecache_get_page(mapping, index, fgp_flags, in grab_cache_page_write_begin()
3284 mapping_gfp_mask(mapping)); in grab_cache_page_write_begin()
3295 struct address_space *mapping = file->f_mapping; in generic_perform_write() local
3296 const struct address_space_operations *a_ops = mapping->a_ops; in generic_perform_write()
3333 status = a_ops->write_begin(file, mapping, pos, bytes, flags, in generic_perform_write()
3338 if (mapping_writably_mapped(mapping)) in generic_perform_write()
3344 status = a_ops->write_end(file, mapping, pos, bytes, copied, in generic_perform_write()
3369 balance_dirty_pages_ratelimited(mapping); in generic_perform_write()
3400 struct address_space * mapping = file->f_mapping; in __generic_file_write_iter() local
3401 struct inode *inode = mapping->host; in __generic_file_write_iter()
3448 err = filemap_write_and_wait_range(mapping, pos, endbyte); in __generic_file_write_iter()
3452 invalidate_mapping_pages(mapping, in __generic_file_write_iter()
3522 struct address_space * const mapping = page->mapping; in try_to_release_page() local
3528 if (mapping && mapping->a_ops->releasepage) in try_to_release_page()
3529 return mapping->a_ops->releasepage(page, gfp_mask); in try_to_release_page()