Lines Matching refs:req
56 static void nfs_redirty_request(struct nfs_page *req);
61 static void nfs_inode_remove_request(struct nfs_page *req);
63 struct nfs_page *req);
148 nfs_page_set_inode_ref(struct nfs_page *req, struct inode *inode) in nfs_page_set_inode_ref() argument
150 if (!test_and_set_bit(PG_INODE_REF, &req->wb_flags)) { in nfs_page_set_inode_ref()
151 kref_get(&req->wb_kref); in nfs_page_set_inode_ref()
157 nfs_cancel_remove_inode(struct nfs_page *req, struct inode *inode) in nfs_cancel_remove_inode() argument
161 if (!test_bit(PG_REMOVE, &req->wb_flags)) in nfs_cancel_remove_inode()
163 ret = nfs_page_group_lock(req); in nfs_cancel_remove_inode()
166 if (test_and_clear_bit(PG_REMOVE, &req->wb_flags)) in nfs_cancel_remove_inode()
167 nfs_page_set_inode_ref(req, inode); in nfs_cancel_remove_inode()
168 nfs_page_group_unlock(req); in nfs_cancel_remove_inode()
183 struct nfs_page *req; in nfs_folio_find_head_request() local
188 req = folio->private; in nfs_folio_find_head_request()
189 if (req) { in nfs_folio_find_head_request()
190 WARN_ON_ONCE(req->wb_head != req); in nfs_folio_find_head_request()
191 kref_get(&req->wb_kref); in nfs_folio_find_head_request()
194 return req; in nfs_folio_find_head_request()
265 struct nfs_page *req; in nfs_page_group_search_locked() local
267 req = head; in nfs_page_group_search_locked()
269 if (page_offset >= req->wb_pgbase && in nfs_page_group_search_locked()
270 page_offset < (req->wb_pgbase + req->wb_bytes)) in nfs_page_group_search_locked()
271 return req; in nfs_page_group_search_locked()
273 req = req->wb_this_page; in nfs_page_group_search_locked()
274 } while (req != head); in nfs_page_group_search_locked()
286 static bool nfs_page_group_covers_page(struct nfs_page *req) in nfs_page_group_covers_page() argument
288 unsigned int len = nfs_folio_length(nfs_page_to_folio(req)); in nfs_page_group_covers_page()
292 nfs_page_group_lock(req); in nfs_page_group_covers_page()
295 tmp = nfs_page_group_search_locked(req->wb_head, pos); in nfs_page_group_covers_page()
301 nfs_page_group_unlock(req); in nfs_page_group_covers_page()
308 static void nfs_mark_uptodate(struct nfs_page *req) in nfs_mark_uptodate() argument
310 struct folio *folio = nfs_page_to_folio(req); in nfs_mark_uptodate()
314 if (!nfs_page_group_covers_page(req)) in nfs_mark_uptodate()
359 static void nfs_page_end_writeback(struct nfs_page *req) in nfs_page_end_writeback() argument
361 if (nfs_page_group_sync_on_bit(req, PG_WB_END)) { in nfs_page_end_writeback()
362 nfs_unlock_request(req); in nfs_page_end_writeback()
363 nfs_folio_end_writeback(nfs_page_to_folio(req)); in nfs_page_end_writeback()
365 nfs_unlock_request(req); in nfs_page_end_writeback()
487 static int nfs_wait_on_request(struct nfs_page *req) in nfs_wait_on_request() argument
489 if (!test_bit(PG_BUSY, &req->wb_flags)) in nfs_wait_on_request()
491 set_bit(PG_CONTENDED2, &req->wb_flags); in nfs_wait_on_request()
493 return wait_on_bit_io(&req->wb_flags, PG_BUSY, in nfs_wait_on_request()
506 nfs_unroll_locks(struct nfs_page *head, struct nfs_page *req) in nfs_unroll_locks() argument
511 for (tmp = head->wb_this_page ; tmp != req; tmp = tmp->wb_this_page) { in nfs_unroll_locks()
622 static void nfs_write_error(struct nfs_page *req, int error) in nfs_write_error() argument
624 trace_nfs_write_error(nfs_page_to_inode(req), req, error); in nfs_write_error()
625 nfs_mapping_set_error(nfs_page_to_folio(req), error); in nfs_write_error()
626 nfs_inode_remove_request(req); in nfs_write_error()
627 nfs_page_end_writeback(req); in nfs_write_error()
628 nfs_release_request(req); in nfs_write_error()
638 struct nfs_page *req; in nfs_do_writepage() local
643 req = nfs_lock_and_join_requests(folio); in nfs_do_writepage()
644 if (!req) in nfs_do_writepage()
646 if (IS_ERR(req)) in nfs_do_writepage()
647 return PTR_ERR(req); in nfs_do_writepage()
650 WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); in nfs_do_writepage()
657 if (!nfs_pageio_add_request(pgio, req)) { in nfs_do_writepage()
665 nfs_redirty_request(req); in nfs_do_writepage()
674 nfs_write_error(req, ret); in nfs_do_writepage()
758 static void nfs_inode_add_request(struct nfs_page *req) in nfs_inode_add_request() argument
760 struct folio *folio = nfs_page_to_folio(req); in nfs_inode_add_request()
764 WARN_ON_ONCE(req->wb_this_page != req); in nfs_inode_add_request()
767 nfs_lock_request(req); in nfs_inode_add_request()
769 set_bit(PG_MAPPED, &req->wb_flags); in nfs_inode_add_request()
771 folio->private = req; in nfs_inode_add_request()
778 WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags)); in nfs_inode_add_request()
779 kref_get(&req->wb_kref); in nfs_inode_add_request()
785 static void nfs_inode_remove_request(struct nfs_page *req) in nfs_inode_remove_request() argument
787 struct nfs_inode *nfsi = NFS_I(nfs_page_to_inode(req)); in nfs_inode_remove_request()
789 if (nfs_page_group_sync_on_bit(req, PG_REMOVE)) { in nfs_inode_remove_request()
790 struct folio *folio = nfs_page_to_folio(req->wb_head); in nfs_inode_remove_request()
797 clear_bit(PG_MAPPED, &req->wb_head->wb_flags); in nfs_inode_remove_request()
802 if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) { in nfs_inode_remove_request()
804 nfs_release_request(req); in nfs_inode_remove_request()
808 static void nfs_mark_request_dirty(struct nfs_page *req) in nfs_mark_request_dirty() argument
810 struct folio *folio = nfs_page_to_folio(req); in nfs_mark_request_dirty()
829 nfs_request_add_commit_list_locked(struct nfs_page *req, struct list_head *dst, in nfs_request_add_commit_list_locked() argument
832 set_bit(PG_CLEAN, &req->wb_flags); in nfs_request_add_commit_list_locked()
833 nfs_list_add_request(req, dst); in nfs_request_add_commit_list_locked()
851 nfs_request_add_commit_list(struct nfs_page *req, struct nfs_commit_info *cinfo) in nfs_request_add_commit_list() argument
854 nfs_request_add_commit_list_locked(req, &cinfo->mds->list, cinfo); in nfs_request_add_commit_list()
856 nfs_folio_mark_unstable(nfs_page_to_folio(req), cinfo); in nfs_request_add_commit_list()
872 nfs_request_remove_commit_list(struct nfs_page *req, in nfs_request_remove_commit_list() argument
875 if (!test_and_clear_bit(PG_CLEAN, &(req)->wb_flags)) in nfs_request_remove_commit_list()
877 nfs_list_remove_request(req); in nfs_request_remove_commit_list()
907 nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, in nfs_mark_request_commit() argument
910 if (pnfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx)) in nfs_mark_request_commit()
912 nfs_request_add_commit_list(req, cinfo); in nfs_mark_request_commit()
928 struct nfs_page *req) in nfs_clear_request_commit() argument
930 if (test_bit(PG_CLEAN, &req->wb_flags)) { in nfs_clear_request_commit()
931 struct nfs_open_context *ctx = nfs_req_openctx(req); in nfs_clear_request_commit()
935 if (!pnfs_clear_request_commit(req, cinfo)) { in nfs_clear_request_commit()
936 nfs_request_remove_commit_list(req, cinfo); in nfs_clear_request_commit()
939 nfs_folio_clear_commit(nfs_page_to_folio(req)); in nfs_clear_request_commit()
964 struct nfs_page *req = nfs_list_entry(hdr->pages.next); in nfs_write_completion() local
966 bytes += req->wb_bytes; in nfs_write_completion()
967 nfs_list_remove_request(req); in nfs_write_completion()
970 trace_nfs_comp_error(hdr->inode, req, hdr->error); in nfs_write_completion()
971 nfs_mapping_set_error(nfs_page_to_folio(req), in nfs_write_completion()
977 req->wb_nio = 0; in nfs_write_completion()
978 memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf)); in nfs_write_completion()
979 nfs_mark_request_commit(req, hdr->lseg, &cinfo, in nfs_write_completion()
984 nfs_inode_remove_request(req); in nfs_write_completion()
986 nfs_page_end_writeback(req); in nfs_write_completion()
987 nfs_release_request(req); in nfs_write_completion()
1005 struct nfs_page *req, *tmp; in nfs_scan_commit_list() local
1008 list_for_each_entry_safe(req, tmp, src, wb_list) { in nfs_scan_commit_list()
1009 kref_get(&req->wb_kref); in nfs_scan_commit_list()
1010 if (!nfs_lock_request(req)) { in nfs_scan_commit_list()
1011 nfs_release_request(req); in nfs_scan_commit_list()
1014 nfs_request_remove_commit_list(req, cinfo); in nfs_scan_commit_list()
1015 clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); in nfs_scan_commit_list()
1016 nfs_list_add_request(req, dst); in nfs_scan_commit_list()
1066 struct nfs_page *req; in nfs_try_to_update_request() local
1073 req = nfs_lock_and_join_requests(folio); in nfs_try_to_update_request()
1074 if (IS_ERR_OR_NULL(req)) in nfs_try_to_update_request()
1075 return req; in nfs_try_to_update_request()
1077 rqend = req->wb_offset + req->wb_bytes; in nfs_try_to_update_request()
1084 if (offset > rqend || end < req->wb_offset) in nfs_try_to_update_request()
1088 if (offset < req->wb_offset) { in nfs_try_to_update_request()
1089 req->wb_offset = offset; in nfs_try_to_update_request()
1090 req->wb_pgbase = offset; in nfs_try_to_update_request()
1093 req->wb_bytes = end - req->wb_offset; in nfs_try_to_update_request()
1095 req->wb_bytes = rqend - req->wb_offset; in nfs_try_to_update_request()
1096 req->wb_nio = 0; in nfs_try_to_update_request()
1097 return req; in nfs_try_to_update_request()
1104 nfs_mark_request_dirty(req); in nfs_try_to_update_request()
1105 nfs_unlock_and_release_request(req); in nfs_try_to_update_request()
1122 struct nfs_page *req; in nfs_setup_write_request() local
1124 req = nfs_try_to_update_request(folio, offset, bytes); in nfs_setup_write_request()
1125 if (req != NULL) in nfs_setup_write_request()
1127 req = nfs_page_create_from_folio(ctx, folio, offset, bytes); in nfs_setup_write_request()
1128 if (IS_ERR(req)) in nfs_setup_write_request()
1130 nfs_inode_add_request(req); in nfs_setup_write_request()
1132 return req; in nfs_setup_write_request()
1139 struct nfs_page *req; in nfs_writepage_setup() local
1141 req = nfs_setup_write_request(ctx, folio, offset, count); in nfs_writepage_setup()
1142 if (IS_ERR(req)) in nfs_writepage_setup()
1143 return PTR_ERR(req); in nfs_writepage_setup()
1146 nfs_mark_uptodate(req); in nfs_writepage_setup()
1147 nfs_mark_request_dirty(req); in nfs_writepage_setup()
1148 nfs_unlock_and_release_request(req); in nfs_writepage_setup()
1157 struct nfs_page *req; in nfs_flush_incompatible() local
1168 req = nfs_folio_find_head_request(folio); in nfs_flush_incompatible()
1169 if (req == NULL) in nfs_flush_incompatible()
1171 l_ctx = req->wb_lock_context; in nfs_flush_incompatible()
1172 do_flush = nfs_page_to_folio(req) != folio || in nfs_flush_incompatible()
1173 !nfs_match_open_context(nfs_req_openctx(req), ctx); in nfs_flush_incompatible()
1179 nfs_release_request(req); in nfs_flush_incompatible()
1397 static void nfs_redirty_request(struct nfs_page *req) in nfs_redirty_request() argument
1399 struct nfs_inode *nfsi = NFS_I(nfs_page_to_inode(req)); in nfs_redirty_request()
1402 req->wb_nio++; in nfs_redirty_request()
1403 nfs_mark_request_dirty(req); in nfs_redirty_request()
1405 nfs_page_end_writeback(req); in nfs_redirty_request()
1406 nfs_release_request(req); in nfs_redirty_request()
1411 struct nfs_page *req; in nfs_async_write_error() local
1414 req = nfs_list_entry(head->next); in nfs_async_write_error()
1415 nfs_list_remove_request(req); in nfs_async_write_error()
1417 nfs_write_error(req, error); in nfs_async_write_error()
1419 nfs_redirty_request(req); in nfs_async_write_error()
1710 struct nfs_page *req; in nfs_get_lwb() local
1712 list_for_each_entry(req, head, wb_list) in nfs_get_lwb()
1713 if (lwb < (req_offset(req) + req->wb_bytes)) in nfs_get_lwb()
1714 lwb = req_offset(req) + req->wb_bytes; in nfs_get_lwb()
1768 struct nfs_page *req; in nfs_retry_commit() local
1771 req = nfs_list_entry(page_list->next); in nfs_retry_commit()
1772 nfs_list_remove_request(req); in nfs_retry_commit()
1773 nfs_mark_request_commit(req, lseg, cinfo, ds_commit_idx); in nfs_retry_commit()
1774 nfs_folio_clear_commit(nfs_page_to_folio(req)); in nfs_retry_commit()
1775 nfs_unlock_and_release_request(req); in nfs_retry_commit()
1781 struct nfs_page *req) in nfs_commit_resched_write() argument
1783 struct folio *folio = nfs_page_to_folio(req); in nfs_commit_resched_write()
1837 struct nfs_page *req; in nfs_commit_release_pages() local
1843 req = nfs_list_entry(data->pages.next); in nfs_commit_release_pages()
1844 nfs_list_remove_request(req); in nfs_commit_release_pages()
1845 folio = nfs_page_to_folio(req); in nfs_commit_release_pages()
1849 nfs_req_openctx(req)->dentry->d_sb->s_id, in nfs_commit_release_pages()
1850 (unsigned long long)NFS_FILEID(d_inode(nfs_req_openctx(req)->dentry)), in nfs_commit_release_pages()
1851 req->wb_bytes, in nfs_commit_release_pages()
1852 (long long)req_offset(req)); in nfs_commit_release_pages()
1855 trace_nfs_commit_error(data->inode, req, in nfs_commit_release_pages()
1858 nfs_inode_remove_request(req); in nfs_commit_release_pages()
1866 if (nfs_write_match_verf(verf, req)) { in nfs_commit_release_pages()
1869 nfs_inode_remove_request(req); in nfs_commit_release_pages()
1875 nfs_mark_request_dirty(req); in nfs_commit_release_pages()
1878 nfs_unlock_and_release_request(req); in nfs_commit_release_pages()
2039 struct nfs_page *req; in nfs_wb_folio_cancel() local
2046 req = nfs_lock_and_join_requests(folio); in nfs_wb_folio_cancel()
2048 if (IS_ERR(req)) { in nfs_wb_folio_cancel()
2049 ret = PTR_ERR(req); in nfs_wb_folio_cancel()
2050 } else if (req) { in nfs_wb_folio_cancel()
2055 nfs_inode_remove_request(req); in nfs_wb_folio_cancel()
2056 nfs_unlock_and_release_request(req); in nfs_wb_folio_cancel()