Lines Matching full:object
29 * object and processor if needed.
56 * This will get its own ref on the object.
60 struct fscache_cookie *cookie = op->object->cookie; in fscache_enqueue_operation()
63 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
67 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
96 static void fscache_run_op(struct fscache_object *object, in fscache_run_op() argument
102 object->n_in_progress++; in fscache_run_op()
108 trace_fscache_op(object->cookie, op, fscache_op_run); in fscache_run_op()
115 static void fscache_report_unexpected_submission(struct fscache_object *object, in fscache_report_unexpected_submission() argument
128 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
129 kdebug("objstate=%s [%s]", object->state->name, ostate->name); in fscache_report_unexpected_submission()
130 kdebug("objflags=%lx", object->flags); in fscache_report_unexpected_submission()
131 kdebug("objevent=%lx [%lx]", object->events, object->event_mask); in fscache_report_unexpected_submission()
133 object->n_ops, object->n_in_progress, object->n_exclusive); in fscache_report_unexpected_submission()
135 if (!list_empty(&object->pending_ops)) { in fscache_report_unexpected_submission()
137 list_for_each_entry(p, &object->pending_ops, pend_link) { in fscache_report_unexpected_submission()
138 ASSERTCMP(p->object, ==, object); in fscache_report_unexpected_submission()
150 * submit an exclusive operation for an object
154 int fscache_submit_exclusive_op(struct fscache_object *object, in fscache_submit_exclusive_op() argument
161 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
163 trace_fscache_op(object->cookie, op, fscache_op_submit_ex); in fscache_submit_exclusive_op()
168 spin_lock(&object->lock); in fscache_submit_exclusive_op()
169 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_exclusive_op()
170 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_exclusive_op()
173 ostate = object->state; in fscache_submit_exclusive_op()
177 flags = READ_ONCE(object->flags); in fscache_submit_exclusive_op()
183 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_exclusive_op()
188 op->object = object; in fscache_submit_exclusive_op()
189 object->n_ops++; in fscache_submit_exclusive_op()
190 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
192 if (object->n_in_progress > 0) { in fscache_submit_exclusive_op()
194 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
196 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_exclusive_op()
198 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
200 fscache_start_operations(object); in fscache_submit_exclusive_op()
202 ASSERTCMP(object->n_in_progress, ==, 0); in fscache_submit_exclusive_op()
203 fscache_run_op(object, op); in fscache_submit_exclusive_op()
207 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in fscache_submit_exclusive_op()
210 op->object = object; in fscache_submit_exclusive_op()
211 object->n_ops++; in fscache_submit_exclusive_op()
212 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
214 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
222 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_exclusive_op()
228 spin_unlock(&object->lock); in fscache_submit_exclusive_op()
233 * submit an operation for an object
235 * - during object creation (write ops may be submitted)
236 * - whilst the object is active
240 int fscache_submit_op(struct fscache_object *object, in fscache_submit_op() argument
248 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
250 trace_fscache_op(object->cookie, op, fscache_op_submit); in fscache_submit_op()
255 spin_lock(&object->lock); in fscache_submit_op()
256 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_op()
257 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_op()
260 ostate = object->state; in fscache_submit_op()
264 flags = READ_ONCE(object->flags); in fscache_submit_op()
270 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_op()
275 op->object = object; in fscache_submit_op()
276 object->n_ops++; in fscache_submit_op()
278 if (object->n_exclusive > 0) { in fscache_submit_op()
280 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
282 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_op()
284 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
286 fscache_start_operations(object); in fscache_submit_op()
288 ASSERTCMP(object->n_exclusive, ==, 0); in fscache_submit_op()
289 fscache_run_op(object, op); in fscache_submit_op()
293 op->object = object; in fscache_submit_op()
294 object->n_ops++; in fscache_submit_op()
296 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
304 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
305 ASSERT(!fscache_object_is_active(object)); in fscache_submit_op()
311 spin_unlock(&object->lock); in fscache_submit_op()
316 * queue an object for withdrawal on error, aborting all following asynchronous
319 void fscache_abort_object(struct fscache_object *object) in fscache_abort_object() argument
321 _enter("{OBJ%x}", object->debug_id); in fscache_abort_object()
323 fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); in fscache_abort_object()
327 * Jump start the operation processing on an object. The caller must hold
328 * object->lock.
330 void fscache_start_operations(struct fscache_object *object) in fscache_start_operations() argument
335 while (!list_empty(&object->pending_ops) && !stop) { in fscache_start_operations()
336 op = list_entry(object->pending_ops.next, in fscache_start_operations()
340 if (object->n_in_progress > 0) in fscache_start_operations()
345 fscache_run_op(object, op); in fscache_start_operations()
347 /* the pending queue was holding a ref on the object */ in fscache_start_operations()
351 ASSERTCMP(object->n_in_progress, <=, object->n_ops); in fscache_start_operations()
354 object->n_in_progress, object->debug_id); in fscache_start_operations()
358 * cancel an operation that's pending on an object
363 struct fscache_object *object = op->object; in fscache_cancel_op() local
367 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
369 trace_fscache_op(object->cookie, op, fscache_op_cancel); in fscache_cancel_op()
375 spin_lock(&object->lock); in fscache_cancel_op()
387 object->n_exclusive--; in fscache_cancel_op()
392 ASSERTCMP(object->n_in_progress, >, 0); in fscache_cancel_op()
394 object->n_exclusive--; in fscache_cancel_op()
395 object->n_in_progress--; in fscache_cancel_op()
396 if (object->n_in_progress == 0) in fscache_cancel_op()
397 fscache_start_operations(object); in fscache_cancel_op()
403 object->n_exclusive--; in fscache_cancel_op()
411 spin_unlock(&object->lock); in fscache_cancel_op()
417 * Cancel all pending operations on an object
419 void fscache_cancel_all_ops(struct fscache_object *object) in fscache_cancel_all_ops() argument
423 _enter("OBJ%x", object->debug_id); in fscache_cancel_all_ops()
425 spin_lock(&object->lock); in fscache_cancel_all_ops()
427 while (!list_empty(&object->pending_ops)) { in fscache_cancel_all_ops()
428 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
433 trace_fscache_op(object->cookie, op, fscache_op_cancel_all); in fscache_cancel_all_ops()
440 object->n_exclusive--; in fscache_cancel_all_ops()
444 cond_resched_lock(&object->lock); in fscache_cancel_all_ops()
447 spin_unlock(&object->lock); in fscache_cancel_all_ops()
456 struct fscache_object *object = op->object; in fscache_op_complete() local
458 _enter("OBJ%x", object->debug_id); in fscache_op_complete()
461 ASSERTCMP(object->n_in_progress, >, 0); in fscache_op_complete()
463 object->n_exclusive, >, 0); in fscache_op_complete()
465 object->n_in_progress, ==, 1); in fscache_op_complete()
467 spin_lock(&object->lock); in fscache_op_complete()
470 trace_fscache_op(object->cookie, op, fscache_op_completed); in fscache_op_complete()
474 trace_fscache_op(object->cookie, op, fscache_op_cancelled); in fscache_op_complete()
479 object->n_exclusive--; in fscache_op_complete()
480 object->n_in_progress--; in fscache_op_complete()
481 if (object->n_in_progress == 0) in fscache_op_complete()
482 fscache_start_operations(object); in fscache_op_complete()
484 spin_unlock(&object->lock); in fscache_op_complete()
495 struct fscache_object *object; in fscache_put_operation() local
499 op->object ? op->object->debug_id : 0, in fscache_put_operation()
507 trace_fscache_op(op->object ? op->object->cookie : NULL, op, fscache_op_put); in fscache_put_operation()
522 object = op->object; in fscache_put_operation()
523 if (likely(object)) { in fscache_put_operation()
525 atomic_dec(&object->n_reads); in fscache_put_operation()
527 fscache_unuse_cookie(object); in fscache_put_operation()
529 /* now... we may get called with the object spinlock held, so we in fscache_put_operation()
532 if (!spin_trylock(&object->lock)) { in fscache_put_operation()
536 cache = object->cache; in fscache_put_operation()
545 ASSERTCMP(object->n_ops, >, 0); in fscache_put_operation()
546 object->n_ops--; in fscache_put_operation()
547 if (object->n_ops == 0) in fscache_put_operation()
548 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_put_operation()
550 spin_unlock(&object->lock); in fscache_put_operation()
564 struct fscache_object *object; in fscache_operation_gc() local
583 object = op->object; in fscache_operation_gc()
584 trace_fscache_op(object->cookie, op, fscache_op_gc); in fscache_operation_gc()
586 spin_lock(&object->lock); in fscache_operation_gc()
589 object->debug_id, op->debug_id); in fscache_operation_gc()
595 ASSERTCMP(object->n_ops, >, 0); in fscache_operation_gc()
596 object->n_ops--; in fscache_operation_gc()
597 if (object->n_ops == 0) in fscache_operation_gc()
598 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_operation_gc()
600 spin_unlock(&object->lock); in fscache_operation_gc()
613 * the caller holds a ref to this object, so we don't need to hold one
622 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()
624 trace_fscache_op(op->object->cookie, op, fscache_op_work); in fscache_op_work_func()