Lines Matching refs:op
20 struct afs_operation *op; in afs_alloc_operation() local
24 op = kzalloc(sizeof(*op), GFP_KERNEL); in afs_alloc_operation()
25 if (!op) in afs_alloc_operation()
31 kfree(op); in afs_alloc_operation()
38 op->key = key; in afs_alloc_operation()
39 op->volume = afs_get_volume(volume, afs_volume_trace_get_new_op); in afs_alloc_operation()
40 op->net = volume->cell->net; in afs_alloc_operation()
41 op->cb_v_break = atomic_read(&volume->cb_v_break); in afs_alloc_operation()
42 op->pre_volsync.creation = volume->creation_time; in afs_alloc_operation()
43 op->pre_volsync.update = volume->update_time; in afs_alloc_operation()
44 op->debug_id = atomic_inc_return(&afs_operation_debug_counter); in afs_alloc_operation()
45 op->nr_iterations = -1; in afs_alloc_operation()
46 afs_op_set_error(op, -EDESTADDRREQ); in afs_alloc_operation()
48 _leave(" = [op=%08x]", op->debug_id); in afs_alloc_operation()
49 return op; in afs_alloc_operation()
154 static bool afs_get_io_locks(struct afs_operation *op) in afs_get_io_locks() argument
156 struct afs_vnode *vnode = op->file[0].vnode; in afs_get_io_locks()
157 struct afs_vnode *vnode2 = op->file[1].vnode; in afs_get_io_locks()
161 if (op->flags & AFS_OPERATION_UNINTR) { in afs_get_io_locks()
163 op->flags |= AFS_OPERATION_LOCK_0; in afs_get_io_locks()
168 if (!vnode2 || !op->file[1].need_io_lock || vnode == vnode2) in afs_get_io_locks()
175 afs_op_set_error(op, -ERESTARTSYS); in afs_get_io_locks()
176 op->flags |= AFS_OPERATION_STOP; in afs_get_io_locks()
180 op->flags |= AFS_OPERATION_LOCK_0; in afs_get_io_locks()
184 afs_op_set_error(op, -ERESTARTSYS); in afs_get_io_locks()
185 op->flags |= AFS_OPERATION_STOP; in afs_get_io_locks()
187 op->flags &= ~AFS_OPERATION_LOCK_0; in afs_get_io_locks()
191 op->flags |= AFS_OPERATION_LOCK_1; in afs_get_io_locks()
198 static void afs_drop_io_locks(struct afs_operation *op) in afs_drop_io_locks() argument
200 struct afs_vnode *vnode = op->file[0].vnode; in afs_drop_io_locks()
201 struct afs_vnode *vnode2 = op->file[1].vnode; in afs_drop_io_locks()
205 if (op->flags & AFS_OPERATION_LOCK_1) in afs_drop_io_locks()
207 if (op->flags & AFS_OPERATION_LOCK_0) in afs_drop_io_locks()
211 static void afs_prepare_vnode(struct afs_operation *op, struct afs_vnode_param *vp, in afs_prepare_vnode() argument
221 op->flags |= AFS_OPERATION_CUR_ONLY; in afs_prepare_vnode()
237 bool afs_begin_vnode_operation(struct afs_operation *op) in afs_begin_vnode_operation() argument
239 struct afs_vnode *vnode = op->file[0].vnode; in afs_begin_vnode_operation()
245 if (op->file[0].need_io_lock) in afs_begin_vnode_operation()
246 if (!afs_get_io_locks(op)) in afs_begin_vnode_operation()
249 afs_prepare_vnode(op, &op->file[0], 0); in afs_begin_vnode_operation()
250 afs_prepare_vnode(op, &op->file[1], 1); in afs_begin_vnode_operation()
251 op->cb_v_break = atomic_read(&op->volume->cb_v_break); in afs_begin_vnode_operation()
259 void afs_end_vnode_operation(struct afs_operation *op) in afs_end_vnode_operation() argument
263 switch (afs_op_error(op)) { in afs_end_vnode_operation()
268 afs_dump_edestaddrreq(op); in afs_end_vnode_operation()
272 afs_drop_io_locks(op); in afs_end_vnode_operation()
278 void afs_wait_for_operation(struct afs_operation *op) in afs_wait_for_operation() argument
282 while (afs_select_fileserver(op)) { in afs_wait_for_operation()
283 op->call_responded = false; in afs_wait_for_operation()
284 op->call_error = 0; in afs_wait_for_operation()
285 op->call_abort_code = 0; in afs_wait_for_operation()
286 if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && in afs_wait_for_operation()
287 op->ops->issue_yfs_rpc) in afs_wait_for_operation()
288 op->ops->issue_yfs_rpc(op); in afs_wait_for_operation()
289 else if (op->ops->issue_afs_rpc) in afs_wait_for_operation()
290 op->ops->issue_afs_rpc(op); in afs_wait_for_operation()
292 op->call_error = -ENOTSUPP; in afs_wait_for_operation()
294 if (op->call) { in afs_wait_for_operation()
295 afs_wait_for_call_to_complete(op->call); in afs_wait_for_operation()
296 op->call_abort_code = op->call->abort_code; in afs_wait_for_operation()
297 op->call_error = op->call->error; in afs_wait_for_operation()
298 op->call_responded = op->call->responded; in afs_wait_for_operation()
299 afs_put_call(op->call); in afs_wait_for_operation()
303 if (op->call_responded && op->server) in afs_wait_for_operation()
304 set_bit(AFS_SERVER_FL_RESPONDING, &op->server->flags); in afs_wait_for_operation()
306 if (!afs_op_error(op)) { in afs_wait_for_operation()
308 op->ops->success(op); in afs_wait_for_operation()
309 } else if (op->cumul_error.aborted) { in afs_wait_for_operation()
310 if (op->ops->aborted) in afs_wait_for_operation()
311 op->ops->aborted(op); in afs_wait_for_operation()
313 if (op->ops->failed) in afs_wait_for_operation()
314 op->ops->failed(op); in afs_wait_for_operation()
317 afs_end_vnode_operation(op); in afs_wait_for_operation()
319 if (!afs_op_error(op) && op->ops->edit_dir) { in afs_wait_for_operation()
321 op->ops->edit_dir(op); in afs_wait_for_operation()
329 int afs_put_operation(struct afs_operation *op) in afs_put_operation() argument
332 int i, ret = afs_op_error(op); in afs_put_operation()
334 _enter("op=%08x,%d", op->debug_id, ret); in afs_put_operation()
336 if (op->ops && op->ops->put) in afs_put_operation()
337 op->ops->put(op); in afs_put_operation()
338 if (op->file[0].modification) in afs_put_operation()
339 clear_bit(AFS_VNODE_MODIFYING, &op->file[0].vnode->flags); in afs_put_operation()
340 if (op->file[1].modification && op->file[1].vnode != op->file[0].vnode) in afs_put_operation()
341 clear_bit(AFS_VNODE_MODIFYING, &op->file[1].vnode->flags); in afs_put_operation()
342 if (op->file[0].put_vnode) in afs_put_operation()
343 iput(&op->file[0].vnode->netfs.inode); in afs_put_operation()
344 if (op->file[1].put_vnode) in afs_put_operation()
345 iput(&op->file[1].vnode->netfs.inode); in afs_put_operation()
347 if (op->more_files) { in afs_put_operation()
348 for (i = 0; i < op->nr_files - 2; i++) in afs_put_operation()
349 if (op->more_files[i].put_vnode) in afs_put_operation()
350 iput(&op->more_files[i].vnode->netfs.inode); in afs_put_operation()
351 kfree(op->more_files); in afs_put_operation()
354 if (op->estate) { in afs_put_operation()
355 alist = op->estate->addresses; in afs_put_operation()
357 if (op->call_responded && in afs_put_operation()
358 op->addr_index != alist->preferred && in afs_put_operation()
359 test_bit(alist->preferred, &op->addr_tried)) in afs_put_operation()
360 WRITE_ONCE(alist->preferred, op->addr_index); in afs_put_operation()
364 afs_clear_server_states(op); in afs_put_operation()
365 afs_put_serverlist(op->net, op->server_list); in afs_put_operation()
366 afs_put_volume(op->volume, afs_volume_trace_put_put_op); in afs_put_operation()
367 key_put(op->key); in afs_put_operation()
368 kfree(op); in afs_put_operation()
372 int afs_do_sync_operation(struct afs_operation *op) in afs_do_sync_operation() argument
374 afs_begin_vnode_operation(op); in afs_do_sync_operation()
375 afs_wait_for_operation(op); in afs_do_sync_operation()
376 return afs_put_operation(op); in afs_do_sync_operation()