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()
136 bool afs_begin_vnode_operation(struct afs_operation *op) in afs_begin_vnode_operation() argument
138 struct afs_vnode *vnode = op->file[0].vnode; in afs_begin_vnode_operation()
144 if (op->file[0].need_io_lock) in afs_begin_vnode_operation()
145 if (!afs_get_io_locks(op)) in afs_begin_vnode_operation()
148 afs_prepare_vnode(op, &op->file[0], 0); in afs_begin_vnode_operation()
149 afs_prepare_vnode(op, &op->file[1], 1); in afs_begin_vnode_operation()
150 op->cb_v_break = op->volume->cb_v_break; in afs_begin_vnode_operation()
158 static void afs_end_vnode_operation(struct afs_operation *op) in afs_end_vnode_operation() argument
162 if (op->error == -EDESTADDRREQ || in afs_end_vnode_operation()
163 op->error == -EADDRNOTAVAIL || in afs_end_vnode_operation()
164 op->error == -ENETUNREACH || in afs_end_vnode_operation()
165 op->error == -EHOSTUNREACH) in afs_end_vnode_operation()
166 afs_dump_edestaddrreq(op); in afs_end_vnode_operation()
168 afs_drop_io_locks(op); in afs_end_vnode_operation()
170 if (op->error == -ECONNABORTED) in afs_end_vnode_operation()
171 op->error = afs_abort_to_error(op->ac.abort_code); in afs_end_vnode_operation()
177 void afs_wait_for_operation(struct afs_operation *op) in afs_wait_for_operation() argument
181 while (afs_select_fileserver(op)) { in afs_wait_for_operation()
182 op->cb_s_break = op->server->cb_s_break; in afs_wait_for_operation()
183 if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && in afs_wait_for_operation()
184 op->ops->issue_yfs_rpc) in afs_wait_for_operation()
185 op->ops->issue_yfs_rpc(op); in afs_wait_for_operation()
186 else if (op->ops->issue_afs_rpc) in afs_wait_for_operation()
187 op->ops->issue_afs_rpc(op); in afs_wait_for_operation()
189 op->ac.error = -ENOTSUPP; in afs_wait_for_operation()
191 if (op->call) in afs_wait_for_operation()
192 op->error = afs_wait_for_call_to_complete(op->call, &op->ac); in afs_wait_for_operation()
195 switch (op->error) { in afs_wait_for_operation()
198 op->ops->success(op); in afs_wait_for_operation()
201 if (op->ops->aborted) in afs_wait_for_operation()
202 op->ops->aborted(op); in afs_wait_for_operation()
205 if (op->ops->failed) in afs_wait_for_operation()
206 op->ops->failed(op); in afs_wait_for_operation()
210 afs_end_vnode_operation(op); in afs_wait_for_operation()
212 if (op->error == 0 && op->ops->edit_dir) { in afs_wait_for_operation()
214 op->ops->edit_dir(op); in afs_wait_for_operation()
222 int afs_put_operation(struct afs_operation *op) in afs_put_operation() argument
224 int i, ret = op->error; in afs_put_operation()
226 _enter("op=%08x,%d", op->debug_id, ret); in afs_put_operation()
228 if (op->ops && op->ops->put) in afs_put_operation()
229 op->ops->put(op); in afs_put_operation()
230 if (op->file[0].modification) in afs_put_operation()
231 clear_bit(AFS_VNODE_MODIFYING, &op->file[0].vnode->flags); in afs_put_operation()
232 if (op->file[1].modification && op->file[1].vnode != op->file[0].vnode) in afs_put_operation()
233 clear_bit(AFS_VNODE_MODIFYING, &op->file[1].vnode->flags); in afs_put_operation()
234 if (op->file[0].put_vnode) in afs_put_operation()
235 iput(&op->file[0].vnode->vfs_inode); in afs_put_operation()
236 if (op->file[1].put_vnode) in afs_put_operation()
237 iput(&op->file[1].vnode->vfs_inode); in afs_put_operation()
239 if (op->more_files) { in afs_put_operation()
240 for (i = 0; i < op->nr_files - 2; i++) in afs_put_operation()
241 if (op->more_files[i].put_vnode) in afs_put_operation()
242 iput(&op->more_files[i].vnode->vfs_inode); in afs_put_operation()
243 kfree(op->more_files); in afs_put_operation()
246 afs_end_cursor(&op->ac); in afs_put_operation()
247 afs_put_serverlist(op->net, op->server_list); in afs_put_operation()
248 afs_put_volume(op->net, op->volume, afs_volume_trace_put_put_op); in afs_put_operation()
249 key_put(op->key); in afs_put_operation()
250 kfree(op); in afs_put_operation()
254 int afs_do_sync_operation(struct afs_operation *op) in afs_do_sync_operation() argument
256 afs_begin_vnode_operation(op); in afs_do_sync_operation()
257 afs_wait_for_operation(op); in afs_do_sync_operation()
258 return afs_put_operation(op); in afs_do_sync_operation()