Lines Matching full:object
33 * object and processor if needed.
60 * This will get its own ref on the object.
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()
71 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
100 static void fscache_run_op(struct fscache_object *object, in fscache_run_op() argument
106 object->n_in_progress++; in fscache_run_op()
112 trace_fscache_op(object->cookie, op, fscache_op_run); in fscache_run_op()
119 static void fscache_report_unexpected_submission(struct fscache_object *object, in fscache_report_unexpected_submission() argument
132 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
133 kdebug("objstate=%s [%s]", object->state->name, ostate->name); in fscache_report_unexpected_submission()
134 kdebug("objflags=%lx", object->flags); in fscache_report_unexpected_submission()
135 kdebug("objevent=%lx [%lx]", object->events, object->event_mask); in fscache_report_unexpected_submission()
137 object->n_ops, object->n_in_progress, object->n_exclusive); in fscache_report_unexpected_submission()
139 if (!list_empty(&object->pending_ops)) { in fscache_report_unexpected_submission()
141 list_for_each_entry(p, &object->pending_ops, pend_link) { in fscache_report_unexpected_submission()
142 ASSERTCMP(p->object, ==, object); in fscache_report_unexpected_submission()
154 * submit an exclusive operation for an object
158 int fscache_submit_exclusive_op(struct fscache_object *object, 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()
172 spin_lock(&object->lock); in fscache_submit_exclusive_op()
173 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_exclusive_op()
174 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_exclusive_op()
177 ostate = object->state; in fscache_submit_exclusive_op()
181 flags = READ_ONCE(object->flags); in fscache_submit_exclusive_op()
187 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_exclusive_op()
192 op->object = object; in fscache_submit_exclusive_op()
193 object->n_ops++; in fscache_submit_exclusive_op()
194 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
196 if (object->n_in_progress > 0) { in fscache_submit_exclusive_op()
198 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
200 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_exclusive_op()
202 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
204 fscache_start_operations(object); in fscache_submit_exclusive_op()
206 ASSERTCMP(object->n_in_progress, ==, 0); in fscache_submit_exclusive_op()
207 fscache_run_op(object, op); in fscache_submit_exclusive_op()
211 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in fscache_submit_exclusive_op()
214 op->object = object; in fscache_submit_exclusive_op()
215 object->n_ops++; in fscache_submit_exclusive_op()
216 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
218 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
226 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_exclusive_op()
232 spin_unlock(&object->lock); in fscache_submit_exclusive_op()
237 * submit an operation for an object
239 * - during object creation (write ops may be submitted)
240 * - whilst the object is active
244 int fscache_submit_op(struct fscache_object *object, 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()
259 spin_lock(&object->lock); in fscache_submit_op()
260 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_op()
261 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_op()
264 ostate = object->state; in fscache_submit_op()
268 flags = READ_ONCE(object->flags); in fscache_submit_op()
274 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_op()
279 op->object = object; in fscache_submit_op()
280 object->n_ops++; in fscache_submit_op()
282 if (object->n_exclusive > 0) { in fscache_submit_op()
284 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
286 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_op()
288 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
290 fscache_start_operations(object); in fscache_submit_op()
292 ASSERTCMP(object->n_exclusive, ==, 0); in fscache_submit_op()
293 fscache_run_op(object, op); in fscache_submit_op()
297 op->object = object; in fscache_submit_op()
298 object->n_ops++; in fscache_submit_op()
300 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
308 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
309 ASSERT(!fscache_object_is_active(object)); in fscache_submit_op()
315 spin_unlock(&object->lock); in fscache_submit_op()
320 * queue an object for withdrawal on error, aborting all following asynchronous
323 void fscache_abort_object(struct fscache_object *object) in fscache_abort_object() argument
325 _enter("{OBJ%x}", object->debug_id); in fscache_abort_object()
327 fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); in fscache_abort_object()
331 * Jump start the operation processing on an object. The caller must hold
332 * object->lock.
334 void fscache_start_operations(struct fscache_object *object) in fscache_start_operations() argument
339 while (!list_empty(&object->pending_ops) && !stop) { in fscache_start_operations()
340 op = list_entry(object->pending_ops.next, in fscache_start_operations()
344 if (object->n_in_progress > 0) in fscache_start_operations()
349 fscache_run_op(object, op); in fscache_start_operations()
351 /* the pending queue was holding a ref on the object */ in fscache_start_operations()
355 ASSERTCMP(object->n_in_progress, <=, object->n_ops); in fscache_start_operations()
358 object->n_in_progress, object->debug_id); in fscache_start_operations()
362 * cancel an operation that's pending on an object
367 struct fscache_object *object = op->object; in fscache_cancel_op() local
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()
379 spin_lock(&object->lock); in fscache_cancel_op()
391 object->n_exclusive--; in fscache_cancel_op()
396 ASSERTCMP(object->n_in_progress, >, 0); in fscache_cancel_op()
398 object->n_exclusive--; in fscache_cancel_op()
399 object->n_in_progress--; in fscache_cancel_op()
400 if (object->n_in_progress == 0) in fscache_cancel_op()
401 fscache_start_operations(object); in fscache_cancel_op()
407 object->n_exclusive--; in fscache_cancel_op()
415 spin_unlock(&object->lock); in fscache_cancel_op()
421 * Cancel all pending operations on an object
423 void fscache_cancel_all_ops(struct fscache_object *object) in fscache_cancel_all_ops() argument
427 _enter("OBJ%x", object->debug_id); in fscache_cancel_all_ops()
429 spin_lock(&object->lock); in fscache_cancel_all_ops()
431 while (!list_empty(&object->pending_ops)) { in fscache_cancel_all_ops()
432 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
437 trace_fscache_op(object->cookie, op, fscache_op_cancel_all); in fscache_cancel_all_ops()
444 object->n_exclusive--; in fscache_cancel_all_ops()
448 cond_resched_lock(&object->lock); in fscache_cancel_all_ops()
451 spin_unlock(&object->lock); in fscache_cancel_all_ops()
460 struct fscache_object *object = op->object; in fscache_op_complete() local
462 _enter("OBJ%x", object->debug_id); in fscache_op_complete()
465 ASSERTCMP(object->n_in_progress, >, 0); in fscache_op_complete()
467 object->n_exclusive, >, 0); in fscache_op_complete()
469 object->n_in_progress, ==, 1); in fscache_op_complete()
471 spin_lock(&object->lock); in fscache_op_complete()
474 trace_fscache_op(object->cookie, op, fscache_op_completed); in fscache_op_complete()
478 trace_fscache_op(object->cookie, op, fscache_op_cancelled); in fscache_op_complete()
483 object->n_exclusive--; in fscache_op_complete()
484 object->n_in_progress--; in fscache_op_complete()
485 if (object->n_in_progress == 0) in fscache_op_complete()
486 fscache_start_operations(object); in fscache_op_complete()
488 spin_unlock(&object->lock); in fscache_op_complete()
499 struct fscache_object *object; in fscache_put_operation() local
503 op->object ? op->object->debug_id : 0, in fscache_put_operation()
511 trace_fscache_op(op->object ? op->object->cookie : NULL, op, fscache_op_put); in fscache_put_operation()
526 object = op->object; in fscache_put_operation()
527 if (likely(object)) { in fscache_put_operation()
529 atomic_dec(&object->n_reads); in fscache_put_operation()
531 fscache_unuse_cookie(object); in fscache_put_operation()
533 /* now... we may get called with the object spinlock held, so we in fscache_put_operation()
536 if (!spin_trylock(&object->lock)) { in fscache_put_operation()
540 cache = object->cache; in fscache_put_operation()
549 ASSERTCMP(object->n_ops, >, 0); in fscache_put_operation()
550 object->n_ops--; in fscache_put_operation()
551 if (object->n_ops == 0) in fscache_put_operation()
552 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_put_operation()
554 spin_unlock(&object->lock); in fscache_put_operation()
568 struct fscache_object *object; in fscache_operation_gc() local
587 object = op->object; in fscache_operation_gc()
588 trace_fscache_op(object->cookie, op, fscache_op_gc); in fscache_operation_gc()
590 spin_lock(&object->lock); in fscache_operation_gc()
593 object->debug_id, op->debug_id); in fscache_operation_gc()
599 ASSERTCMP(object->n_ops, >, 0); in fscache_operation_gc()
600 object->n_ops--; in fscache_operation_gc()
601 if (object->n_ops == 0) in fscache_operation_gc()
602 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_operation_gc()
604 spin_unlock(&object->lock); in fscache_operation_gc()
617 * the caller holds a ref to this object, so we don't need to hold one
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()