Lines Matching defs:op
25 * @op: The operation to enqueue
31 void fscache_enqueue_operation(struct fscache_operation *op)
34 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
36 fscache_set_op_state(op, "EnQ");
38 ASSERT(list_empty(&op->pend_link));
39 ASSERT(op->processor != NULL);
40 ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE);
41 ASSERTCMP(atomic_read(&op->usage), >, 0);
44 switch (op->flags & FSCACHE_OP_TYPE) {
47 atomic_inc(&op->usage);
48 if (!queue_work(fscache_op_wq, &op->work))
49 fscache_put_operation(op);
55 printk(KERN_ERR "FS-Cache: Unexpected op type %lx",
56 op->flags);
64 * start an op running
67 struct fscache_operation *op)
69 fscache_set_op_state(op, "Run");
72 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags))
73 wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
74 if (op->processor)
75 fscache_enqueue_operation(op);
82 * - this gets any extra refs it needs on an op
85 struct fscache_operation *op)
89 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id);
91 fscache_set_op_state(op, "SubmitX");
96 ASSERT(list_empty(&op->pend_link));
100 op->object = object;
105 atomic_inc(&op->usage);
106 list_add_tail(&op->pend_link, &object->pending_ops);
109 atomic_inc(&op->usage);
110 list_add_tail(&op->pend_link, &object->pending_ops);
115 fscache_run_op(object, op);
118 /* need to issue a new write op after this */
122 op->object = object;
125 atomic_inc(&op->usage);
126 list_add_tail(&op->pend_link, &object->pending_ops);
142 struct fscache_operation *op,
154 op->debug_id, object->debug_id,
168 kdebug("%p %p", op->processor, op->release);
183 * - after an I/O error incurred in one of the two above states (op rejected)
184 * - this gets any extra refs it needs on an op
187 struct fscache_operation *op)
193 object->debug_id, op->debug_id, atomic_read(&op->usage));
195 ASSERTCMP(atomic_read(&op->usage), >, 0);
197 fscache_set_op_state(op, "Submit");
202 ASSERT(list_empty(&op->pend_link));
208 op->object = object;
212 atomic_inc(&op->usage);
213 list_add_tail(&op->pend_link, &object->pending_ops);
216 atomic_inc(&op->usage);
217 list_add_tail(&op->pend_link, &object->pending_ops);
222 fscache_run_op(object, op);
226 op->object = object;
228 atomic_inc(&op->usage);
229 list_add_tail(&op->pend_link, &object->pending_ops);
238 fscache_report_unexpected_submission(object, op, ostate);
266 struct fscache_operation *op;
270 op = list_entry(object->pending_ops.next,
273 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) {
278 list_del_init(&op->pend_link);
279 fscache_run_op(object, op);
282 fscache_put_operation(op);
294 int fscache_cancel_op(struct fscache_operation *op)
296 struct fscache_object *object = op->object;
299 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id);
304 if (!list_empty(&op->pend_link)) {
306 list_del_init(&op->pend_link);
308 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
310 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags))
311 wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
312 fscache_put_operation(op);
323 * - queues pending ops if this is the last in-progress op
325 void fscache_put_operation(struct fscache_operation *op)
331 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
333 ASSERTCMP(atomic_read(&op->usage), >, 0);
335 if (!atomic_dec_and_test(&op->usage))
338 fscache_set_op_state(op, "Put");
341 if (test_and_set_bit(FSCACHE_OP_DEAD, &op->flags))
346 if (op->release) {
347 op->release(op);
348 op->release = NULL;
351 object = op->object;
353 if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags))
365 list_add_tail(&op->pend_link, &cache->op_gc_list);
372 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) {
389 kfree(op);
399 struct fscache_operation *op;
414 op = list_entry(cache->op_gc_list.next,
416 list_del(&op->pend_link);
419 object = op->object;
422 object->debug_id, op->debug_id);
425 ASSERTCMP(atomic_read(&op->usage), ==, 0);
428 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) {
459 struct fscache_operation *op =
464 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
466 ASSERT(op->processor != NULL);
468 op->processor(op);
470 fscache_put_operation(op);