Lines Matching refs:op

19 static void fscache_operation_dummy_cancel(struct fscache_operation *op)  in fscache_operation_dummy_cancel()  argument
35 struct fscache_operation *op, in fscache_operation_init() argument
40 INIT_WORK(&op->work, fscache_op_work_func); in fscache_operation_init()
41 atomic_set(&op->usage, 1); in fscache_operation_init()
42 op->state = FSCACHE_OP_ST_INITIALISED; in fscache_operation_init()
43 op->debug_id = atomic_inc_return(&fscache_op_debug_id); in fscache_operation_init()
44 op->processor = processor; in fscache_operation_init()
45 op->cancel = cancel ?: fscache_operation_dummy_cancel; in fscache_operation_init()
46 op->release = release; in fscache_operation_init()
47 INIT_LIST_HEAD(&op->pend_link); in fscache_operation_init()
49 trace_fscache_op(cookie, op, fscache_op_init); in fscache_operation_init()
61 void fscache_enqueue_operation(struct fscache_operation *op) in fscache_enqueue_operation() argument
63 struct fscache_cookie *cookie = op->object->cookie; in fscache_enqueue_operation()
66 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
68 ASSERT(list_empty(&op->pend_link)); in fscache_enqueue_operation()
69 ASSERT(op->processor != NULL); in fscache_enqueue_operation()
70 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
71 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_enqueue_operation()
72 ASSERTIFCMP(op->state != FSCACHE_OP_ST_IN_PROGRESS, in fscache_enqueue_operation()
73 op->state, ==, FSCACHE_OP_ST_CANCELLED); in fscache_enqueue_operation()
76 switch (op->flags & FSCACHE_OP_TYPE) { in fscache_enqueue_operation()
78 trace_fscache_op(cookie, op, fscache_op_enqueue_async); in fscache_enqueue_operation()
80 atomic_inc(&op->usage); in fscache_enqueue_operation()
81 if (!queue_work(fscache_op_wq, &op->work)) in fscache_enqueue_operation()
82 fscache_put_operation(op); in fscache_enqueue_operation()
85 trace_fscache_op(cookie, op, fscache_op_enqueue_mythread); in fscache_enqueue_operation()
89 pr_err("Unexpected op type %lx", op->flags); in fscache_enqueue_operation()
100 struct fscache_operation *op) in fscache_run_op() argument
102 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_run_op()
104 op->state = FSCACHE_OP_ST_IN_PROGRESS; in fscache_run_op()
106 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_run_op()
107 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_run_op()
108 if (op->processor) in fscache_run_op()
109 fscache_enqueue_operation(op); in fscache_run_op()
111 trace_fscache_op(object->cookie, op, fscache_op_run); in fscache_run_op()
119 struct fscache_operation *op, in fscache_report_unexpected_submission() argument
131 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
142 kdebug("%p %p", op->processor, op->release); in fscache_report_unexpected_submission()
158 struct fscache_operation *op) in fscache_submit_exclusive_op() argument
164 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
166 trace_fscache_op(object->cookie, op, fscache_op_submit_ex); in fscache_submit_exclusive_op()
168 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_exclusive_op()
169 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_exclusive_op()
174 ASSERT(list_empty(&op->pend_link)); in fscache_submit_exclusive_op()
179 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_exclusive_op()
183 op->cancel(op); in fscache_submit_exclusive_op()
184 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
187 op->cancel(op); in fscache_submit_exclusive_op()
188 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
191 op->object = object; in fscache_submit_exclusive_op()
196 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
197 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
200 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
201 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
206 fscache_run_op(object, op); in fscache_submit_exclusive_op()
213 op->object = object; in fscache_submit_exclusive_op()
216 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
217 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
221 op->cancel(op); in fscache_submit_exclusive_op()
222 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
225 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_exclusive_op()
226 op->cancel(op); in fscache_submit_exclusive_op()
227 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
244 struct fscache_operation *op) in fscache_submit_op() argument
251 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
253 trace_fscache_op(object->cookie, op, fscache_op_submit); in fscache_submit_op()
255 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_op()
256 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_op()
261 ASSERT(list_empty(&op->pend_link)); in fscache_submit_op()
266 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_op()
270 op->cancel(op); in fscache_submit_op()
271 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
274 op->cancel(op); in fscache_submit_op()
275 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
278 op->object = object; in fscache_submit_op()
282 atomic_inc(&op->usage); in fscache_submit_op()
283 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
286 atomic_inc(&op->usage); in fscache_submit_op()
287 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
292 fscache_run_op(object, op); in fscache_submit_op()
296 op->object = object; in fscache_submit_op()
298 atomic_inc(&op->usage); in fscache_submit_op()
299 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
303 op->cancel(op); in fscache_submit_op()
304 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
307 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
309 op->cancel(op); in fscache_submit_op()
310 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
335 struct fscache_operation *op; in fscache_start_operations() local
339 op = list_entry(object->pending_ops.next, in fscache_start_operations()
342 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) { in fscache_start_operations()
347 list_del_init(&op->pend_link); in fscache_start_operations()
348 fscache_run_op(object, op); in fscache_start_operations()
351 fscache_put_operation(op); in fscache_start_operations()
363 int fscache_cancel_op(struct fscache_operation *op, in fscache_cancel_op() argument
366 struct fscache_object *object = op->object; in fscache_cancel_op()
370 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
372 trace_fscache_op(object->cookie, op, fscache_op_cancel); in fscache_cancel_op()
374 ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING); in fscache_cancel_op()
375 ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED); in fscache_cancel_op()
376 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_cancel_op()
381 if (op->state == FSCACHE_OP_ST_PENDING) { in fscache_cancel_op()
382 ASSERT(!list_empty(&op->pend_link)); in fscache_cancel_op()
383 list_del_init(&op->pend_link); in fscache_cancel_op()
387 op->cancel(op); in fscache_cancel_op()
388 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_op()
389 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
391 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_op()
392 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_op()
394 } else if (op->state == FSCACHE_OP_ST_IN_PROGRESS && cancel_in_progress_op) { in fscache_cancel_op()
396 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
403 op->cancel(op); in fscache_cancel_op()
404 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_op()
405 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
407 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_op()
408 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_op()
413 fscache_put_operation(op); in fscache_cancel_op()
424 struct fscache_operation *op; in fscache_cancel_all_ops() local
431 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
434 list_del_init(&op->pend_link); in fscache_cancel_all_ops()
436 trace_fscache_op(object->cookie, op, fscache_op_cancel_all); in fscache_cancel_all_ops()
438 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_cancel_all_ops()
439 op->cancel(op); in fscache_cancel_all_ops()
440 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_all_ops()
442 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_all_ops()
444 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_all_ops()
445 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_all_ops()
446 fscache_put_operation(op); in fscache_cancel_all_ops()
457 void fscache_op_complete(struct fscache_operation *op, bool cancelled) in fscache_op_complete() argument
459 struct fscache_object *object = op->object; in fscache_op_complete()
463 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); in fscache_op_complete()
465 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
467 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
473 trace_fscache_op(object->cookie, op, fscache_op_completed); in fscache_op_complete()
474 op->state = FSCACHE_OP_ST_COMPLETE; in fscache_op_complete()
476 op->cancel(op); in fscache_op_complete()
477 trace_fscache_op(object->cookie, op, fscache_op_cancelled); in fscache_op_complete()
478 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_op_complete()
481 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_op_complete()
496 void fscache_put_operation(struct fscache_operation *op) in fscache_put_operation() argument
502 op->object ? op->object->debug_id : 0, in fscache_put_operation()
503 op->debug_id, atomic_read(&op->usage)); in fscache_put_operation()
505 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_put_operation()
507 if (!atomic_dec_and_test(&op->usage)) in fscache_put_operation()
510 trace_fscache_op(op->object ? op->object->cookie : NULL, op, fscache_op_put); in fscache_put_operation()
513 ASSERTIFCMP(op->state != FSCACHE_OP_ST_INITIALISED && in fscache_put_operation()
514 op->state != FSCACHE_OP_ST_COMPLETE, in fscache_put_operation()
515 op->state, ==, FSCACHE_OP_ST_CANCELLED); in fscache_put_operation()
519 if (op->release) { in fscache_put_operation()
520 op->release(op); in fscache_put_operation()
521 op->release = NULL; in fscache_put_operation()
523 op->state = FSCACHE_OP_ST_DEAD; in fscache_put_operation()
525 object = op->object; in fscache_put_operation()
527 if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) in fscache_put_operation()
529 if (test_bit(FSCACHE_OP_UNUSE_COOKIE, &op->flags)) in fscache_put_operation()
541 list_add_tail(&op->pend_link, &cache->op_gc_list); in fscache_put_operation()
556 kfree(op); in fscache_put_operation()
566 struct fscache_operation *op; in fscache_operation_gc() local
581 op = list_entry(cache->op_gc_list.next, in fscache_operation_gc()
583 list_del(&op->pend_link); in fscache_operation_gc()
586 object = op->object; in fscache_operation_gc()
587 trace_fscache_op(object->cookie, op, fscache_op_gc); in fscache_operation_gc()
592 object->debug_id, op->debug_id); in fscache_operation_gc()
595 ASSERTCMP(atomic_read(&op->usage), ==, 0); in fscache_operation_gc()
596 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_DEAD); in fscache_operation_gc()
604 kfree(op); in fscache_operation_gc()
620 struct fscache_operation *op = in fscache_op_work_func() local
624 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()
626 trace_fscache_op(op->object->cookie, op, fscache_op_work); in fscache_op_work_func()
628 ASSERT(op->processor != NULL); in fscache_op_work_func()
629 op->processor(op); in fscache_op_work_func()
630 fscache_put_operation(op); in fscache_op_work_func()