Lines Matching refs:object
34 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
38 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
64 static void fscache_run_op(struct fscache_object *object, in fscache_run_op() argument
70 object->n_in_progress++; in fscache_run_op()
83 int fscache_submit_exclusive_op(struct fscache_object *object, in fscache_submit_exclusive_op() argument
88 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
93 spin_lock(&object->lock); in fscache_submit_exclusive_op()
94 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_exclusive_op()
95 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_exclusive_op()
99 if (fscache_object_is_active(object)) { in fscache_submit_exclusive_op()
100 op->object = object; in fscache_submit_exclusive_op()
101 object->n_ops++; in fscache_submit_exclusive_op()
102 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
104 if (object->n_in_progress > 0) { in fscache_submit_exclusive_op()
106 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
108 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_exclusive_op()
110 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
112 fscache_start_operations(object); in fscache_submit_exclusive_op()
114 ASSERTCMP(object->n_in_progress, ==, 0); in fscache_submit_exclusive_op()
115 fscache_run_op(object, op); in fscache_submit_exclusive_op()
119 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in fscache_submit_exclusive_op()
121 } else if (test_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_submit_exclusive_op()
122 op->object = object; in fscache_submit_exclusive_op()
123 object->n_ops++; in fscache_submit_exclusive_op()
124 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
126 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
133 ASSERT(test_bit(FSCACHE_IOERROR, &object->cache->flags)); in fscache_submit_exclusive_op()
137 spin_unlock(&object->lock); in fscache_submit_exclusive_op()
144 static void fscache_report_unexpected_submission(struct fscache_object *object, in fscache_report_unexpected_submission() argument
157 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
158 kdebug("objstate=%s [%s]", object->state->name, ostate->name); in fscache_report_unexpected_submission()
159 kdebug("objflags=%lx", object->flags); in fscache_report_unexpected_submission()
160 kdebug("objevent=%lx [%lx]", object->events, object->event_mask); in fscache_report_unexpected_submission()
162 object->n_ops, object->n_in_progress, object->n_exclusive); in fscache_report_unexpected_submission()
164 if (!list_empty(&object->pending_ops)) { in fscache_report_unexpected_submission()
166 list_for_each_entry(p, &object->pending_ops, pend_link) { in fscache_report_unexpected_submission()
167 ASSERTCMP(p->object, ==, object); in fscache_report_unexpected_submission()
186 int fscache_submit_op(struct fscache_object *object, in fscache_submit_op() argument
193 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
198 spin_lock(&object->lock); in fscache_submit_op()
199 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_op()
200 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_op()
203 ostate = object->state; in fscache_submit_op()
207 if (fscache_object_is_active(object)) { in fscache_submit_op()
208 op->object = object; in fscache_submit_op()
209 object->n_ops++; in fscache_submit_op()
211 if (object->n_exclusive > 0) { in fscache_submit_op()
213 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
215 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_op()
217 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
219 fscache_start_operations(object); in fscache_submit_op()
221 ASSERTCMP(object->n_exclusive, ==, 0); in fscache_submit_op()
222 fscache_run_op(object, op); in fscache_submit_op()
225 } else if (test_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_submit_op()
226 op->object = object; in fscache_submit_op()
227 object->n_ops++; in fscache_submit_op()
229 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
232 } else if (fscache_object_is_dying(object)) { in fscache_submit_op()
236 } else if (!test_bit(FSCACHE_IOERROR, &object->cache->flags)) { in fscache_submit_op()
237 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
238 ASSERT(!fscache_object_is_active(object)); in fscache_submit_op()
246 spin_unlock(&object->lock); in fscache_submit_op()
254 void fscache_abort_object(struct fscache_object *object) in fscache_abort_object() argument
256 _enter("{OBJ%x}", object->debug_id); in fscache_abort_object()
258 fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); in fscache_abort_object()
265 void fscache_start_operations(struct fscache_object *object) in fscache_start_operations() argument
270 while (!list_empty(&object->pending_ops) && !stop) { in fscache_start_operations()
271 op = list_entry(object->pending_ops.next, in fscache_start_operations()
275 if (object->n_in_progress > 0) in fscache_start_operations()
280 fscache_run_op(object, op); in fscache_start_operations()
286 ASSERTCMP(object->n_in_progress, <=, object->n_ops); in fscache_start_operations()
289 object->n_in_progress, object->debug_id); in fscache_start_operations()
298 struct fscache_object *object = op->object; in fscache_cancel_op() local
301 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
307 spin_lock(&object->lock); in fscache_cancel_op()
318 object->n_exclusive--; in fscache_cancel_op()
325 spin_unlock(&object->lock); in fscache_cancel_op()
333 void fscache_cancel_all_ops(struct fscache_object *object) in fscache_cancel_all_ops() argument
337 _enter("OBJ%x", object->debug_id); in fscache_cancel_all_ops()
339 spin_lock(&object->lock); in fscache_cancel_all_ops()
341 while (!list_empty(&object->pending_ops)) { in fscache_cancel_all_ops()
342 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
351 object->n_exclusive--; in fscache_cancel_all_ops()
355 cond_resched_lock(&object->lock); in fscache_cancel_all_ops()
358 spin_unlock(&object->lock); in fscache_cancel_all_ops()
367 struct fscache_object *object = op->object; in fscache_op_complete() local
369 _enter("OBJ%x", object->debug_id); in fscache_op_complete()
372 ASSERTCMP(object->n_in_progress, >, 0); in fscache_op_complete()
374 object->n_exclusive, >, 0); in fscache_op_complete()
376 object->n_in_progress, ==, 1); in fscache_op_complete()
378 spin_lock(&object->lock); in fscache_op_complete()
384 object->n_exclusive--; in fscache_op_complete()
385 object->n_in_progress--; in fscache_op_complete()
386 if (object->n_in_progress == 0) in fscache_op_complete()
387 fscache_start_operations(object); in fscache_op_complete()
389 spin_unlock(&object->lock); in fscache_op_complete()
400 struct fscache_object *object; in fscache_put_operation() local
404 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_put_operation()
423 object = op->object; in fscache_put_operation()
426 atomic_dec(&object->n_reads); in fscache_put_operation()
428 fscache_unuse_cookie(object); in fscache_put_operation()
433 if (!spin_trylock(&object->lock)) { in fscache_put_operation()
437 cache = object->cache; in fscache_put_operation()
446 ASSERTCMP(object->n_ops, >, 0); in fscache_put_operation()
447 object->n_ops--; in fscache_put_operation()
448 if (object->n_ops == 0) in fscache_put_operation()
449 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_put_operation()
451 spin_unlock(&object->lock); in fscache_put_operation()
464 struct fscache_object *object; in fscache_operation_gc() local
483 object = op->object; in fscache_operation_gc()
484 spin_lock(&object->lock); in fscache_operation_gc()
487 object->debug_id, op->debug_id); in fscache_operation_gc()
493 ASSERTCMP(object->n_ops, >, 0); in fscache_operation_gc()
494 object->n_ops--; in fscache_operation_gc()
495 if (object->n_ops == 0) in fscache_operation_gc()
496 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_operation_gc()
498 spin_unlock(&object->lock); in fscache_operation_gc()
520 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()