Lines Matching refs:folio

35 	struct folio *folio;  in afs_write_begin()  local
49 ret = netfs_write_begin(file, mapping, pos, len, flags, &folio, fsdata, in afs_write_begin()
54 index = folio_index(folio); in afs_write_begin()
62 if (folio_test_private(folio)) { in afs_write_begin()
63 priv = (unsigned long)folio_get_private(folio); in afs_write_begin()
64 f = afs_folio_dirty_from(folio, priv); in afs_write_begin()
65 t = afs_folio_dirty_to(folio, priv); in afs_write_begin()
68 if (folio_test_writeback(folio)) { in afs_write_begin()
69 trace_afs_folio_dirty(vnode, tracepoint_string("alrdy"), folio); in afs_write_begin()
81 *_page = &folio->page; in afs_write_begin()
90 ret = folio_write_one(folio); in afs_write_begin()
94 ret = folio_lock_killable(folio); in afs_write_begin()
100 folio_put(folio); in afs_write_begin()
112 struct folio *folio = page_folio(subpage); in afs_write_end() local
115 unsigned int f, from = offset_in_folio(folio, pos); in afs_write_end()
120 vnode->fid.vid, vnode->fid.vnode, folio_index(folio)); in afs_write_end()
122 if (!folio_test_uptodate(folio)) { in afs_write_end()
128 folio_mark_uptodate(folio); in afs_write_end()
145 if (folio_test_private(folio)) { in afs_write_end()
146 priv = (unsigned long)folio_get_private(folio); in afs_write_end()
147 f = afs_folio_dirty_from(folio, priv); in afs_write_end()
148 t = afs_folio_dirty_to(folio, priv); in afs_write_end()
153 priv = afs_folio_dirty(folio, f, t); in afs_write_end()
154 folio_change_private(folio, (void *)priv); in afs_write_end()
155 trace_afs_folio_dirty(vnode, tracepoint_string("dirty+"), folio); in afs_write_end()
157 priv = afs_folio_dirty(folio, from, to); in afs_write_end()
158 folio_attach_private(folio, (void *)priv); in afs_write_end()
159 trace_afs_folio_dirty(vnode, tracepoint_string("dirty"), folio); in afs_write_end()
162 if (folio_mark_dirty(folio)) in afs_write_end()
163 _debug("dirtied %lx", folio_index(folio)); in afs_write_end()
166 folio_unlock(folio); in afs_write_end()
167 folio_put(folio); in afs_write_end()
178 struct folio *folio; in afs_kill_pages() local
188 folio = filemap_get_folio(mapping, index); in afs_kill_pages()
189 if (!folio) { in afs_kill_pages()
194 next = folio_next_index(folio); in afs_kill_pages()
196 folio_clear_uptodate(folio); in afs_kill_pages()
197 folio_end_writeback(folio); in afs_kill_pages()
198 folio_lock(folio); in afs_kill_pages()
199 generic_error_remove_page(mapping, &folio->page); in afs_kill_pages()
200 folio_unlock(folio); in afs_kill_pages()
201 folio_put(folio); in afs_kill_pages()
216 struct folio *folio; in afs_redirty_pages() local
226 folio = filemap_get_folio(mapping, index); in afs_redirty_pages()
227 if (!folio) { in afs_redirty_pages()
232 next = index + folio_nr_pages(folio); in afs_redirty_pages()
233 folio_redirty_for_writepage(wbc, folio); in afs_redirty_pages()
234 folio_end_writeback(folio); in afs_redirty_pages()
235 folio_put(folio); in afs_redirty_pages()
247 struct folio *folio; in afs_pages_written_back() local
258 xas_for_each(&xas, folio, end) { in afs_pages_written_back()
259 if (!folio_test_writeback(folio)) { in afs_pages_written_back()
261 len, start, folio_index(folio), end); in afs_pages_written_back()
262 ASSERT(folio_test_writeback(folio)); in afs_pages_written_back()
265 trace_afs_folio_dirty(vnode, tracepoint_string("clear"), folio); in afs_pages_written_back()
266 folio_detach_private(folio); in afs_pages_written_back()
267 folio_end_writeback(folio); in afs_pages_written_back()
424 struct folio *folio; in afs_extend_writeback() local
443 xas_for_each(&xas, folio, ULONG_MAX) { in afs_extend_writeback()
445 if (xas_retry(&xas, folio)) in afs_extend_writeback()
447 if (xa_is_value(folio)) in afs_extend_writeback()
449 if (folio_index(folio) != index) in afs_extend_writeback()
452 if (!folio_try_get_rcu(folio)) { in afs_extend_writeback()
458 if (unlikely(folio != xas_reload(&xas))) { in afs_extend_writeback()
459 folio_put(folio); in afs_extend_writeback()
463 if (!folio_trylock(folio)) { in afs_extend_writeback()
464 folio_put(folio); in afs_extend_writeback()
467 if (!folio_test_dirty(folio) || folio_test_writeback(folio)) { in afs_extend_writeback()
468 folio_unlock(folio); in afs_extend_writeback()
469 folio_put(folio); in afs_extend_writeback()
473 psize = folio_size(folio); in afs_extend_writeback()
474 priv = (unsigned long)folio_get_private(folio); in afs_extend_writeback()
475 f = afs_folio_dirty_from(folio, priv); in afs_extend_writeback()
476 t = afs_folio_dirty_to(folio, priv); in afs_extend_writeback()
478 folio_unlock(folio); in afs_extend_writeback()
479 folio_put(folio); in afs_extend_writeback()
490 index += folio_nr_pages(folio); in afs_extend_writeback()
491 if (!pagevec_add(&pvec, &folio->page)) in afs_extend_writeback()
508 folio = page_folio(pvec.pages[i]); in afs_extend_writeback()
509 trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio); in afs_extend_writeback()
511 if (!folio_clear_dirty_for_io(folio)) in afs_extend_writeback()
513 if (folio_start_writeback(folio)) in afs_extend_writeback()
516 *_count -= folio_nr_pages(folio); in afs_extend_writeback()
517 folio_unlock(folio); in afs_extend_writeback()
533 struct folio *folio, in afs_write_back_from_locked_folio() argument
545 _enter(",%lx,%llx-%llx", folio_index(folio), start, end); in afs_write_back_from_locked_folio()
547 if (folio_start_writeback(folio)) in afs_write_back_from_locked_folio()
550 count -= folio_nr_pages(folio); in afs_write_back_from_locked_folio()
557 priv = (unsigned long)folio_get_private(folio); in afs_write_back_from_locked_folio()
558 offset = afs_folio_dirty_from(folio, priv); in afs_write_back_from_locked_folio()
559 to = afs_folio_dirty_to(folio, priv); in afs_write_back_from_locked_folio()
560 trace_afs_folio_dirty(vnode, tracepoint_string("store"), folio); in afs_write_back_from_locked_folio()
573 (to == folio_size(folio) || new_content)) in afs_write_back_from_locked_folio()
583 folio_unlock(folio); in afs_write_back_from_locked_folio()
646 struct folio *folio = page_folio(subpage); in afs_writepage() local
650 _enter("{%lx},", folio_index(folio)); in afs_writepage()
652 start = folio_index(folio) * PAGE_SIZE; in afs_writepage()
653 ret = afs_write_back_from_locked_folio(folio_mapping(folio), wbc, in afs_writepage()
654 folio, start, LLONG_MAX - start); in afs_writepage()
671 struct folio *folio; in afs_writepages_region() local
686 folio = page_folio(head_page); in afs_writepages_region()
687 start = folio_pos(folio); /* May regress with THPs */ in afs_writepages_region()
689 _debug("wback %lx", folio_index(folio)); in afs_writepages_region()
697 ret = folio_lock_killable(folio); in afs_writepages_region()
699 folio_put(folio); in afs_writepages_region()
703 if (!folio_trylock(folio)) { in afs_writepages_region()
704 folio_put(folio); in afs_writepages_region()
709 if (folio_mapping(folio) != mapping || in afs_writepages_region()
710 !folio_test_dirty(folio)) { in afs_writepages_region()
711 start += folio_size(folio); in afs_writepages_region()
712 folio_unlock(folio); in afs_writepages_region()
713 folio_put(folio); in afs_writepages_region()
717 if (folio_test_writeback(folio)) { in afs_writepages_region()
718 folio_unlock(folio); in afs_writepages_region()
720 folio_wait_writeback(folio); in afs_writepages_region()
721 folio_put(folio); in afs_writepages_region()
725 if (!folio_clear_dirty_for_io(folio)) in afs_writepages_region()
727 ret = afs_write_back_from_locked_folio(mapping, wbc, folio, start, end); in afs_writepages_region()
728 folio_put(folio); in afs_writepages_region()
852 struct folio *folio = page_folio(vmf->page); in afs_page_mkwrite() local
860 _enter("{{%llx:%llu}},{%lx}", vnode->fid.vid, vnode->fid.vnode, folio_index(folio)); in afs_page_mkwrite()
870 if (folio_test_fscache(folio) && in afs_page_mkwrite()
871 folio_wait_fscache_killable(folio) < 0) in afs_page_mkwrite()
875 if (folio_wait_writeback_killable(folio)) in afs_page_mkwrite()
878 if (folio_lock_killable(folio) < 0) in afs_page_mkwrite()
885 if (folio_wait_writeback_killable(folio) < 0) { in afs_page_mkwrite()
886 folio_unlock(folio); in afs_page_mkwrite()
890 priv = afs_folio_dirty(folio, 0, folio_size(folio)); in afs_page_mkwrite()
892 if (folio_test_private(folio)) { in afs_page_mkwrite()
893 folio_change_private(folio, (void *)priv); in afs_page_mkwrite()
894 trace_afs_folio_dirty(vnode, tracepoint_string("mkwrite+"), folio); in afs_page_mkwrite()
896 folio_attach_private(folio, (void *)priv); in afs_page_mkwrite()
897 trace_afs_folio_dirty(vnode, tracepoint_string("mkwrite"), folio); in afs_page_mkwrite()
940 struct folio *folio = page_folio(subpage); in afs_launder_page() local
941 struct afs_vnode *vnode = AFS_FS_I(folio_inode(folio)); in afs_launder_page()
948 _enter("{%lx}", folio_index(folio)); in afs_launder_page()
950 priv = (unsigned long)folio_get_private(folio); in afs_launder_page()
951 if (folio_clear_dirty_for_io(folio)) { in afs_launder_page()
953 t = folio_size(folio); in afs_launder_page()
954 if (folio_test_private(folio)) { in afs_launder_page()
955 f = afs_folio_dirty_from(folio, priv); in afs_launder_page()
956 t = afs_folio_dirty_to(folio, priv); in afs_launder_page()
959 bv[0].bv_page = &folio->page; in afs_launder_page()
964 trace_afs_folio_dirty(vnode, tracepoint_string("launder"), folio); in afs_launder_page()
965 ret = afs_store_data(vnode, &iter, folio_pos(folio) + f, true); in afs_launder_page()
968 trace_afs_folio_dirty(vnode, tracepoint_string("laundered"), folio); in afs_launder_page()
969 folio_detach_private(folio); in afs_launder_page()
970 folio_wait_fscache(folio); in afs_launder_page()