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 = volume->cb_v_break; in afs_alloc_operation()
42 op->debug_id = atomic_inc_return(&afs_operation_debug_counter); in afs_alloc_operation()
43 op->error = -EDESTADDRREQ; in afs_alloc_operation()
44 op->ac.error = SHRT_MAX; in afs_alloc_operation()
46 _leave(" = [op=%08x]", op->debug_id); in afs_alloc_operation()
47 return op; in afs_alloc_operation()
53 static bool afs_get_io_locks(struct afs_operation *op) in afs_get_io_locks() argument
55 struct afs_vnode *vnode = op->file[0].vnode; in afs_get_io_locks()
56 struct afs_vnode *vnode2 = op->file[1].vnode; in afs_get_io_locks()
60 if (op->flags & AFS_OPERATION_UNINTR) { in afs_get_io_locks()
62 op->flags |= AFS_OPERATION_LOCK_0; in afs_get_io_locks()
67 if (!vnode2 || !op->file[1].need_io_lock || vnode == vnode2) in afs_get_io_locks()
74 op->error = -ERESTARTSYS; in afs_get_io_locks()
75 op->flags |= AFS_OPERATION_STOP; in afs_get_io_locks()
79 op->flags |= AFS_OPERATION_LOCK_0; in afs_get_io_locks()
83 op->error = -ERESTARTSYS; in afs_get_io_locks()
84 op->flags |= AFS_OPERATION_STOP; in afs_get_io_locks()
86 op->flags &= ~AFS_OPERATION_LOCK_0; in afs_get_io_locks()
90 op->flags |= AFS_OPERATION_LOCK_1; in afs_get_io_locks()
97 static void afs_drop_io_locks(struct afs_operation *op) in afs_drop_io_locks() argument
99 struct afs_vnode *vnode = op->file[0].vnode; in afs_drop_io_locks()
100 struct afs_vnode *vnode2 = op->file[1].vnode; in afs_drop_io_locks()
104 if (op->flags & AFS_OPERATION_LOCK_1) in afs_drop_io_locks()
106 if (op->flags & AFS_OPERATION_LOCK_0) in afs_drop_io_locks()
110 static void afs_prepare_vnode(struct afs_operation *op, struct afs_vnode_param *vp, in afs_prepare_vnode() argument
120 op->flags |= AFS_OPERATION_CUR_ONLY; in afs_prepare_vnode()
134 bool afs_begin_vnode_operation(struct afs_operation *op) in afs_begin_vnode_operation() argument
136 struct afs_vnode *vnode = op->file[0].vnode; in afs_begin_vnode_operation()
142 if (op->file[0].need_io_lock) in afs_begin_vnode_operation()
143 if (!afs_get_io_locks(op)) in afs_begin_vnode_operation()
146 afs_prepare_vnode(op, &op->file[0], 0); in afs_begin_vnode_operation()
147 afs_prepare_vnode(op, &op->file[1], 1); in afs_begin_vnode_operation()
148 op->cb_v_break = op->volume->cb_v_break; in afs_begin_vnode_operation()
156 static void afs_end_vnode_operation(struct afs_operation *op) in afs_end_vnode_operation() argument
160 if (op->error == -EDESTADDRREQ || in afs_end_vnode_operation()
161 op->error == -EADDRNOTAVAIL || in afs_end_vnode_operation()
162 op->error == -ENETUNREACH || in afs_end_vnode_operation()
163 op->error == -EHOSTUNREACH) in afs_end_vnode_operation()
164 afs_dump_edestaddrreq(op); in afs_end_vnode_operation()
166 afs_drop_io_locks(op); in afs_end_vnode_operation()
168 if (op->error == -ECONNABORTED) in afs_end_vnode_operation()
169 op->error = afs_abort_to_error(op->ac.abort_code); in afs_end_vnode_operation()
175 void afs_wait_for_operation(struct afs_operation *op) in afs_wait_for_operation() argument
179 while (afs_select_fileserver(op)) { in afs_wait_for_operation()
180 op->cb_s_break = op->server->cb_s_break; in afs_wait_for_operation()
181 if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && in afs_wait_for_operation()
182 op->ops->issue_yfs_rpc) in afs_wait_for_operation()
183 op->ops->issue_yfs_rpc(op); in afs_wait_for_operation()
185 op->ops->issue_afs_rpc(op); in afs_wait_for_operation()
187 op->error = afs_wait_for_call_to_complete(op->call, &op->ac); in afs_wait_for_operation()
190 switch (op->error) { in afs_wait_for_operation()
193 op->ops->success(op); in afs_wait_for_operation()
196 if (op->ops->aborted) in afs_wait_for_operation()
197 op->ops->aborted(op); in afs_wait_for_operation()
203 afs_end_vnode_operation(op); in afs_wait_for_operation()
205 if (op->error == 0 && op->ops->edit_dir) { in afs_wait_for_operation()
207 op->ops->edit_dir(op); in afs_wait_for_operation()
215 int afs_put_operation(struct afs_operation *op) in afs_put_operation() argument
217 int i, ret = op->error; in afs_put_operation()
219 _enter("op=%08x,%d", op->debug_id, ret); in afs_put_operation()
221 if (op->ops && op->ops->put) in afs_put_operation()
222 op->ops->put(op); in afs_put_operation()
223 if (op->file[0].put_vnode) in afs_put_operation()
224 iput(&op->file[0].vnode->vfs_inode); in afs_put_operation()
225 if (op->file[1].put_vnode) in afs_put_operation()
226 iput(&op->file[1].vnode->vfs_inode); in afs_put_operation()
228 if (op->more_files) { in afs_put_operation()
229 for (i = 0; i < op->nr_files - 2; i++) in afs_put_operation()
230 if (op->more_files[i].put_vnode) in afs_put_operation()
231 iput(&op->more_files[i].vnode->vfs_inode); in afs_put_operation()
232 kfree(op->more_files); in afs_put_operation()
235 afs_end_cursor(&op->ac); in afs_put_operation()
236 afs_put_serverlist(op->net, op->server_list); in afs_put_operation()
237 afs_put_volume(op->net, op->volume, afs_volume_trace_put_put_op); in afs_put_operation()
238 key_put(op->key); in afs_put_operation()
239 kfree(op); in afs_put_operation()
243 int afs_do_sync_operation(struct afs_operation *op) in afs_do_sync_operation() argument
245 afs_begin_vnode_operation(op); in afs_do_sync_operation()
246 afs_wait_for_operation(op); in afs_do_sync_operation()
247 return afs_put_operation(op); in afs_do_sync_operation()