Lines Matching refs:op
31 void fscache_enqueue_operation(struct fscache_operation *op) in fscache_enqueue_operation() argument
34 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
36 ASSERT(list_empty(&op->pend_link)); in fscache_enqueue_operation()
37 ASSERT(op->processor != NULL); in fscache_enqueue_operation()
38 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
39 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_enqueue_operation()
40 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); in fscache_enqueue_operation()
43 switch (op->flags & FSCACHE_OP_TYPE) { in fscache_enqueue_operation()
46 atomic_inc(&op->usage); in fscache_enqueue_operation()
47 if (!queue_work(fscache_op_wq, &op->work)) in fscache_enqueue_operation()
48 fscache_put_operation(op); in fscache_enqueue_operation()
54 pr_err("Unexpected op type %lx", op->flags); in fscache_enqueue_operation()
65 struct fscache_operation *op) in fscache_run_op() argument
67 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_run_op()
69 op->state = FSCACHE_OP_ST_IN_PROGRESS; in fscache_run_op()
71 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_run_op()
72 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_run_op()
73 if (op->processor) in fscache_run_op()
74 fscache_enqueue_operation(op); in fscache_run_op()
84 struct fscache_operation *op) in fscache_submit_exclusive_op() argument
88 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
90 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_exclusive_op()
91 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_exclusive_op()
96 ASSERT(list_empty(&op->pend_link)); in fscache_submit_exclusive_op()
98 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_exclusive_op()
100 op->object = object; in fscache_submit_exclusive_op()
105 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
106 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
109 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
110 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
115 fscache_run_op(object, op); in fscache_submit_exclusive_op()
122 op->object = object; in fscache_submit_exclusive_op()
125 atomic_inc(&op->usage); in fscache_submit_exclusive_op()
126 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
145 struct fscache_operation *op, in fscache_report_unexpected_submission() argument
157 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
168 kdebug("%p %p", op->processor, op->release); in fscache_report_unexpected_submission()
187 struct fscache_operation *op) in fscache_submit_op() argument
193 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
195 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); in fscache_submit_op()
196 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_submit_op()
201 ASSERT(list_empty(&op->pend_link)); in fscache_submit_op()
206 op->state = FSCACHE_OP_ST_PENDING; in fscache_submit_op()
208 op->object = object; in fscache_submit_op()
212 atomic_inc(&op->usage); in fscache_submit_op()
213 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
216 atomic_inc(&op->usage); in fscache_submit_op()
217 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
222 fscache_run_op(object, op); in fscache_submit_op()
226 op->object = object; in fscache_submit_op()
228 atomic_inc(&op->usage); in fscache_submit_op()
229 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
234 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
237 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
239 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
242 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_submit_op()
267 struct fscache_operation *op; in fscache_start_operations() local
271 op = list_entry(object->pending_ops.next, in fscache_start_operations()
274 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) { in fscache_start_operations()
279 list_del_init(&op->pend_link); in fscache_start_operations()
280 fscache_run_op(object, op); in fscache_start_operations()
283 fscache_put_operation(op); in fscache_start_operations()
295 int fscache_cancel_op(struct fscache_operation *op, in fscache_cancel_op() argument
298 struct fscache_object *object = op->object; in fscache_cancel_op()
301 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
303 ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING); in fscache_cancel_op()
304 ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED); in fscache_cancel_op()
305 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_cancel_op()
310 if (op->state == FSCACHE_OP_ST_PENDING) { in fscache_cancel_op()
311 ASSERT(!list_empty(&op->pend_link)); in fscache_cancel_op()
313 list_del_init(&op->pend_link); in fscache_cancel_op()
315 do_cancel(op); in fscache_cancel_op()
316 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_op()
317 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_op()
319 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_op()
320 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_op()
321 fscache_put_operation(op); in fscache_cancel_op()
335 struct fscache_operation *op; in fscache_cancel_all_ops() local
342 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
345 list_del_init(&op->pend_link); in fscache_cancel_all_ops()
347 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); in fscache_cancel_all_ops()
348 op->state = FSCACHE_OP_ST_CANCELLED; in fscache_cancel_all_ops()
350 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_cancel_all_ops()
352 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) in fscache_cancel_all_ops()
353 wake_up_bit(&op->flags, FSCACHE_OP_WAITING); in fscache_cancel_all_ops()
354 fscache_put_operation(op); in fscache_cancel_all_ops()
365 void fscache_op_complete(struct fscache_operation *op, bool cancelled) in fscache_op_complete() argument
367 struct fscache_object *object = op->object; in fscache_op_complete()
371 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); in fscache_op_complete()
373 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
375 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), in fscache_op_complete()
380 op->state = cancelled ? in fscache_op_complete()
383 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) in fscache_op_complete()
398 void fscache_put_operation(struct fscache_operation *op) in fscache_put_operation() argument
404 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_put_operation()
406 ASSERTCMP(atomic_read(&op->usage), >, 0); in fscache_put_operation()
408 if (!atomic_dec_and_test(&op->usage)) in fscache_put_operation()
412 ASSERTIFCMP(op->state != FSCACHE_OP_ST_COMPLETE, in fscache_put_operation()
413 op->state, ==, FSCACHE_OP_ST_CANCELLED); in fscache_put_operation()
414 op->state = FSCACHE_OP_ST_DEAD; in fscache_put_operation()
418 if (op->release) { in fscache_put_operation()
419 op->release(op); in fscache_put_operation()
420 op->release = NULL; in fscache_put_operation()
423 object = op->object; in fscache_put_operation()
425 if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) in fscache_put_operation()
427 if (test_bit(FSCACHE_OP_UNUSE_COOKIE, &op->flags)) in fscache_put_operation()
439 list_add_tail(&op->pend_link, &cache->op_gc_list); in fscache_put_operation()
453 kfree(op); in fscache_put_operation()
463 struct fscache_operation *op; in fscache_operation_gc() local
478 op = list_entry(cache->op_gc_list.next, in fscache_operation_gc()
480 list_del(&op->pend_link); in fscache_operation_gc()
483 object = op->object; in fscache_operation_gc()
487 object->debug_id, op->debug_id); in fscache_operation_gc()
490 ASSERTCMP(atomic_read(&op->usage), ==, 0); in fscache_operation_gc()
491 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_DEAD); in fscache_operation_gc()
499 kfree(op); in fscache_operation_gc()
515 struct fscache_operation *op = in fscache_op_work_func() local
520 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()
522 ASSERT(op->processor != NULL); in fscache_op_work_func()
524 op->processor(op); in fscache_op_work_func()
526 fscache_put_operation(op); in fscache_op_work_func()