Lines Matching refs:req
75 struct nfs_page *req; in nfs_create_request() local
85 req = nfs_page_alloc(); in nfs_create_request()
86 if (req != NULL) in nfs_create_request()
105 req->wb_page = page; in nfs_create_request()
107 req->wb_offset = offset; in nfs_create_request()
108 req->wb_bytes = count; in nfs_create_request()
111 req->wb_cred = get_rpccred(cred); in nfs_create_request()
112 req->wb_inode = inode; in nfs_create_request()
113 req->wb_count = 1; in nfs_create_request()
115 return req; in nfs_create_request()
125 void nfs_clear_request(struct nfs_page *req) in nfs_clear_request() argument
128 if (req->wb_file) { in nfs_clear_request()
129 fput(req->wb_file); in nfs_clear_request()
130 req->wb_file = NULL; in nfs_clear_request()
132 if (req->wb_cred) { in nfs_clear_request()
133 put_rpccred(req->wb_cred); in nfs_clear_request()
134 req->wb_cred = NULL; in nfs_clear_request()
136 if (req->wb_page) { in nfs_clear_request()
137 atomic_dec(&NFS_REQUESTLIST(req->wb_inode)->nr_requests); in nfs_clear_request()
139 BUG_ON(atomic_read(&NFS_REQUESTLIST(req->wb_inode)->nr_requests) < 0); in nfs_clear_request()
141 page_cache_release(req->wb_page); in nfs_clear_request()
142 req->wb_page = NULL; in nfs_clear_request()
154 nfs_release_request(struct nfs_page *req) in nfs_release_request() argument
157 if (--req->wb_count) { in nfs_release_request()
161 __nfs_del_lru(req); in nfs_release_request()
165 BUG_ON(!list_empty(&req->wb_list)); in nfs_release_request()
166 BUG_ON(!list_empty(&req->wb_hash)); in nfs_release_request()
167 BUG_ON(NFS_WBACK_BUSY(req)); in nfs_release_request()
171 nfs_clear_request(req); in nfs_release_request()
172 nfs_page_free(req); in nfs_release_request()
186 nfs_list_add_request(struct nfs_page *req, struct list_head *head) in nfs_list_add_request() argument
189 unsigned long pg_idx = page_index(req->wb_page); in nfs_list_add_request()
192 if (!list_empty(&req->wb_list)) { in nfs_list_add_request()
202 list_add(&req->wb_list, pos); in nfs_list_add_request()
203 req->wb_list_head = head; in nfs_list_add_request()
214 nfs_wait_on_request(struct nfs_page *req) in nfs_wait_on_request() argument
216 struct inode *inode = req->wb_inode; in nfs_wait_on_request()
219 if (!NFS_WBACK_BUSY(req)) in nfs_wait_on_request()
221 return nfs_wait_event(clnt, req->wb_wait, !NFS_WBACK_BUSY(req)); in nfs_wait_on_request()
238 struct nfs_page *req = NULL; in nfs_coalesce_requests() local
242 struct nfs_page *prev = req; in nfs_coalesce_requests()
244 req = nfs_list_entry(head->next); in nfs_coalesce_requests()
246 if (req->wb_cred != prev->wb_cred) in nfs_coalesce_requests()
248 if (page_index(req->wb_page) != page_index(prev->wb_page)+1) in nfs_coalesce_requests()
251 if (req->wb_offset != 0) in nfs_coalesce_requests()
254 nfs_list_remove_request(req); in nfs_coalesce_requests()
255 nfs_list_add_request(req, dst); in nfs_coalesce_requests()
257 if (req->wb_offset + req->wb_bytes != PAGE_CACHE_SIZE) in nfs_coalesce_requests()
276 nfs_scan_forward(struct nfs_page *req, struct list_head *dst, int nmax) in nfs_scan_forward() argument
278 struct nfs_server *server = NFS_SERVER(req->wb_inode); in nfs_scan_forward()
279 struct list_head *pos, *head = req->wb_list_head; in nfs_scan_forward()
280 struct rpc_cred *cred = req->wb_cred; in nfs_scan_forward()
281 unsigned long idx = page_index(req->wb_page) + 1; in nfs_scan_forward()
284 for (pos = req->wb_list.next; nfs_lock_request(req); pos = pos->next) { in nfs_scan_forward()
285 nfs_list_remove_request(req); in nfs_scan_forward()
286 nfs_list_add_request(req, dst); in nfs_scan_forward()
287 __nfs_del_lru(req); in nfs_scan_forward()
288 __nfs_add_lru(&server->lru_busy, req); in nfs_scan_forward()
294 if (req->wb_offset + req->wb_bytes != PAGE_CACHE_SIZE) in nfs_scan_forward()
296 req = nfs_list_entry(pos); in nfs_scan_forward()
297 if (page_index(req->wb_page) != idx++) in nfs_scan_forward()
299 if (req->wb_offset != 0) in nfs_scan_forward()
301 if (req->wb_cred != cred) in nfs_scan_forward()
321 struct nfs_page *req; in nfs_scan_lru() local
325 req = nfs_lru_entry(pos); in nfs_scan_lru()
326 npages = nfs_scan_forward(req, dst, nmax); in nfs_scan_lru()
349 struct nfs_page *req; in nfs_scan_lru_timeout() local
353 req = nfs_lru_entry(pos); in nfs_scan_lru_timeout()
354 if (time_after(req->wb_timeout, jiffies)) in nfs_scan_lru_timeout()
356 npages = nfs_scan_forward(req, dst, nmax); in nfs_scan_lru_timeout()
381 struct nfs_page *req; in nfs_scan_list() local
394 req = nfs_list_entry(pos); in nfs_scan_list()
396 pg_idx = page_index(req->wb_page); in nfs_scan_list()
402 if (!nfs_lock_request(req)) in nfs_scan_list()
404 nfs_list_remove_request(req); in nfs_scan_list()
405 nfs_list_add_request(req, dst); in nfs_scan_list()
406 __nfs_del_lru(req); in nfs_scan_list()
407 __nfs_add_lru(&NFS_SERVER(req->wb_inode)->lru_busy, req); in nfs_scan_list()
429 struct nfs_page *req = NULL; in nfs_try_to_free_pages() local
433 if (req) { in nfs_try_to_free_pages()
434 int status = nfs_wait_on_request(req); in nfs_try_to_free_pages()
435 nfs_release_request(req); in nfs_try_to_free_pages()
438 req = NULL; in nfs_try_to_free_pages()
446 req = nfs_lru_entry(server->lru_busy.next); in nfs_try_to_free_pages()
447 req->wb_count++; in nfs_try_to_free_pages()
448 __nfs_del_lru(req); in nfs_try_to_free_pages()