Lines Matching refs:op

23 static void fscache_operation_dummy_cancel(struct fscache_operation *op)  in fscache_operation_dummy_cancel()  argument
36 struct fscache_operation *op, in fscache_operation_init() argument
41 INIT_WORK(&op->work, fscache_op_work_func); in fscache_operation_init()
42 atomic_set(&op->usage, 1); in fscache_operation_init()
43 op->state = FSCACHE_OP_ST_INITIALISED; in fscache_operation_init()
44 op->debug_id = atomic_inc_return(&fscache_op_debug_id); in fscache_operation_init()
45 op->processor = processor; in fscache_operation_init()
46 op->cancel = cancel ?: fscache_operation_dummy_cancel; in fscache_operation_init()
47 op->release = release; in fscache_operation_init()
48 INIT_LIST_HEAD(&op->pend_link); in fscache_operation_init()
50 trace_fscache_op(cookie, op, fscache_op_init); in fscache_operation_init()
62 void fscache_enqueue_operation(struct fscache_operation *op) in fscache_enqueue_operation() argument
64 struct fscache_cookie *cookie = op->object->cookie; in fscache_enqueue_operation()
67 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
69 ASSERT(list_empty(&op->pend_link)); in fscache_enqueue_operation()
70 ASSERT(op->processor != NULL); in fscache_enqueue_operation()
71 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
72 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_enqueue_operation()
73 ASSERTIFCMP(op->state != FSCACHE_OP_ST_IN_PROGRESS, in fscache_enqueue_operation()
74 op->state, ==, FSCACHE_OP_ST_CANCELLED); in fscache_enqueue_operation()
77 switch (op->flags & FSCACHE_OP_TYPE) { in fscache_enqueue_operation()
79 trace_fscache_op(cookie, op, fscache_op_enqueue_async); in fscache_enqueue_operation()
81 atomic_inc(&op->usage); in fscache_enqueue_operation()
82 if (!queue_work(fscache_op_wq, &op->work)) in fscache_enqueue_operation()
83 fscache_put_operation(op); in fscache_enqueue_operation()
86 trace_fscache_op(cookie, op, fscache_op_enqueue_mythread); in fscache_enqueue_operation()
90 pr_err("Unexpected op type %lx", op->flags); in fscache_enqueue_operation()
101 struct fscache_operation *op) in fscache_run_op() argument
103 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_run_op()
105 op->state = FSCACHE_OP_ST_IN_PROGRESS; in fscache_run_op()
107 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_run_op()
108 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_run_op()
109 if (op->processor) in fscache_run_op()
110 fscache_enqueue_operation(op); in fscache_run_op()
112 trace_fscache_op(object->cookie, op, fscache_op_run); in fscache_run_op()
120 struct fscache_operation *op, in fscache_report_unexpected_submission() argument
132 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
143 kdebug("%p %p", op->processor, op->release); in fscache_report_unexpected_submission()
159 struct fscache_operation *op) in fscache_submit_exclusive_op() argument
165 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
167 trace_fscache_op(object->cookie, op, fscache_op_submit_ex); in fscache_submit_exclusive_op()
169 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_exclusive_op()
170 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_exclusive_op()
175 ASSERT(list_empty(&op->pend_link)); in fscache_submit_exclusive_op()
180 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_exclusive_op()
184 op->cancel(op); in fscache_submit_exclusive_op()
185 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
188 op->cancel(op); in fscache_submit_exclusive_op()
189 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
192 op->object = object; in fscache_submit_exclusive_op()
197 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
198 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
201 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
202 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
207 fscache_run_op(object, op); in fscache_submit_exclusive_op()
214 op->object = object; in fscache_submit_exclusive_op()
217 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
218 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
222 op->cancel(op); in fscache_submit_exclusive_op()
223 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
226 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_exclusive_op()
227 op->cancel(op); in fscache_submit_exclusive_op()
228 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_exclusive_op()
245 struct fscache_operation *op) in fscache_submit_op() argument
252 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
254 trace_fscache_op(object->cookie, op, fscache_op_submit); in fscache_submit_op()
256 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_op()
257 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_op()
262 ASSERT(list_empty(&op->pend_link)); in fscache_submit_op()
267 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_op()
271 op->cancel(op); in fscache_submit_op()
272 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
275 op->cancel(op); in fscache_submit_op()
276 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
279 op->object = object; in fscache_submit_op()
283 atomic_inc(&op->usage); in fscache_submit_op()
284 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
287 atomic_inc(&op->usage); in fscache_submit_op()
288 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
293 fscache_run_op(object, op); in fscache_submit_op()
297 op->object = object; in fscache_submit_op()
299 atomic_inc(&op->usage); in fscache_submit_op()
300 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
304 op->cancel(op); in fscache_submit_op()
305 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
308 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
310 op->cancel(op); in fscache_submit_op()
311 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
336 struct fscache_operation *op; in fscache_start_operations() local
340 op = list_entry(object->pending_ops.next, in fscache_start_operations()
343 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) { in fscache_start_operations()
348 list_del_init(&op->pend_link); in fscache_start_operations()
349 fscache_run_op(object, op); in fscache_start_operations()
352 fscache_put_operation(op); in fscache_start_operations()
364 int fscache_cancel_op(struct fscache_operation *op, in fscache_cancel_op() argument
367 struct fscache_object *object = op->object; in fscache_cancel_op()
371 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
373 trace_fscache_op(object->cookie, op, fscache_op_cancel); in fscache_cancel_op()
375 ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING); in fscache_cancel_op()
376 ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED); in fscache_cancel_op()
377 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_cancel_op()
382 if (op->state == FSCACHE_OP_ST_PENDING) { in fscache_cancel_op()
383 ASSERT(!list_empty(&op->pend_link)); in fscache_cancel_op()
384 list_del_init(&op->pend_link); in fscache_cancel_op()
388 op->cancel(op); in fscache_cancel_op()
389 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_op()
390 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
392 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_op()
393 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_op()
395 } else if (op->state == FSCACHE_OP_ST_IN_PROGRESS && cancel_in_progress_op) { in fscache_cancel_op()
397 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
404 op->cancel(op); in fscache_cancel_op()
405 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_op()
406 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
408 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_op()
409 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_op()
414 fscache_put_operation(op); in fscache_cancel_op()
425 struct fscache_operation *op; in fscache_cancel_all_ops() local
432 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
435 list_del_init(&op->pend_link); in fscache_cancel_all_ops()
437 trace_fscache_op(object->cookie, op, fscache_op_cancel_all); in fscache_cancel_all_ops()
439 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_cancel_all_ops()
440 op->cancel(op); in fscache_cancel_all_ops()
441 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_all_ops()
443 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_all_ops()
445 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_all_ops()
446 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_all_ops()
447 fscache_put_operation(op); in fscache_cancel_all_ops()
458 void fscache_op_complete(struct fscache_operation *op, bool cancelled) in fscache_op_complete() argument
460 struct fscache_object *object = op->object; in fscache_op_complete()
464 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); in fscache_op_complete()
466 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
468 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
474 trace_fscache_op(object->cookie, op, fscache_op_completed); in fscache_op_complete()
475 op->state = FSCACHE_OP_ST_COMPLETE; in fscache_op_complete()
477 op->cancel(op); in fscache_op_complete()
478 trace_fscache_op(object->cookie, op, fscache_op_cancelled); in fscache_op_complete()
479 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_op_complete()
482 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_op_complete()
497 void fscache_put_operation(struct fscache_operation *op) in fscache_put_operation() argument
503 op->object ? op->object->debug_id : 0, in fscache_put_operation()
504 op->debug_id, atomic_read(&op->usage)); in fscache_put_operation()
506 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_put_operation()
508 if (!atomic_dec_and_test(&op->usage)) in fscache_put_operation()
511 trace_fscache_op(op->object ? op->object->cookie : NULL, op, fscache_op_put); in fscache_put_operation()
514 ASSERTIFCMP(op->state != FSCACHE_OP_ST_INITIALISED && in fscache_put_operation()
515 op->state != FSCACHE_OP_ST_COMPLETE, in fscache_put_operation()
516 op->state, ==, FSCACHE_OP_ST_CANCELLED); in fscache_put_operation()
520 if (op->release) { in fscache_put_operation()
521 op->release(op); in fscache_put_operation()
522 op->release = NULL; in fscache_put_operation()
524 op->state = FSCACHE_OP_ST_DEAD; in fscache_put_operation()
526 object = op->object; in fscache_put_operation()
528 if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) in fscache_put_operation()
530 if (test_bit(FSCACHE_OP_UNUSE_COOKIE, &op->flags)) in fscache_put_operation()
542 list_add_tail(&op->pend_link, &cache->op_gc_list); in fscache_put_operation()
557 kfree(op); in fscache_put_operation()
567 struct fscache_operation *op; in fscache_operation_gc() local
582 op = list_entry(cache->op_gc_list.next, in fscache_operation_gc()
584 list_del(&op->pend_link); in fscache_operation_gc()
587 object = op->object; in fscache_operation_gc()
588 trace_fscache_op(object->cookie, op, fscache_op_gc); in fscache_operation_gc()
593 object->debug_id, op->debug_id); in fscache_operation_gc()
596 ASSERTCMP(atomic_read(&op->usage), ==, 0); in fscache_operation_gc()
597 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_DEAD); in fscache_operation_gc()
605 kfree(op); in fscache_operation_gc()
621 struct fscache_operation *op = in fscache_op_work_func() local
626 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()
628 trace_fscache_op(op->object->cookie, op, fscache_op_work); in fscache_op_work_func()
630 ASSERT(op->processor != NULL); in fscache_op_work_func()
632 op->processor(op); in fscache_op_work_func()
634 fscache_put_operation(op); in fscache_op_work_func()