Lines Matching refs:object
63 struct fscache_cookie *cookie = op->object->cookie; in fscache_enqueue_operation()
66 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_enqueue_operation()
70 ASSERT(fscache_object_is_available(op->object)); in fscache_enqueue_operation()
99 static void fscache_run_op(struct fscache_object *object, in fscache_run_op() argument
105 object->n_in_progress++; in fscache_run_op()
111 trace_fscache_op(object->cookie, op, fscache_op_run); in fscache_run_op()
118 static void fscache_report_unexpected_submission(struct fscache_object *object, in fscache_report_unexpected_submission() argument
131 op->debug_id, object->debug_id, object->state->name); in fscache_report_unexpected_submission()
132 kdebug("objstate=%s [%s]", object->state->name, ostate->name); in fscache_report_unexpected_submission()
133 kdebug("objflags=%lx", object->flags); in fscache_report_unexpected_submission()
134 kdebug("objevent=%lx [%lx]", object->events, object->event_mask); in fscache_report_unexpected_submission()
136 object->n_ops, object->n_in_progress, object->n_exclusive); in fscache_report_unexpected_submission()
138 if (!list_empty(&object->pending_ops)) { in fscache_report_unexpected_submission()
140 list_for_each_entry(p, &object->pending_ops, pend_link) { in fscache_report_unexpected_submission()
141 ASSERTCMP(p->object, ==, object); in fscache_report_unexpected_submission()
157 int fscache_submit_exclusive_op(struct fscache_object *object, in fscache_submit_exclusive_op() argument
164 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); in fscache_submit_exclusive_op()
166 trace_fscache_op(object->cookie, op, fscache_op_submit_ex); in fscache_submit_exclusive_op()
171 spin_lock(&object->lock); in fscache_submit_exclusive_op()
172 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_exclusive_op()
173 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_exclusive_op()
176 ostate = object->state; in fscache_submit_exclusive_op()
180 flags = READ_ONCE(object->flags); in fscache_submit_exclusive_op()
186 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_exclusive_op()
191 op->object = object; in fscache_submit_exclusive_op()
192 object->n_ops++; in fscache_submit_exclusive_op()
193 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
195 if (object->n_in_progress > 0) { in fscache_submit_exclusive_op()
197 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
199 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_exclusive_op()
201 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
203 fscache_start_operations(object); in fscache_submit_exclusive_op()
205 ASSERTCMP(object->n_in_progress, ==, 0); in fscache_submit_exclusive_op()
206 fscache_run_op(object, op); in fscache_submit_exclusive_op()
210 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in fscache_submit_exclusive_op()
213 op->object = object; in fscache_submit_exclusive_op()
214 object->n_ops++; in fscache_submit_exclusive_op()
215 object->n_exclusive++; /* reads and writes must wait */ in fscache_submit_exclusive_op()
217 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_exclusive_op()
225 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_exclusive_op()
231 spin_unlock(&object->lock); in fscache_submit_exclusive_op()
243 int fscache_submit_op(struct fscache_object *object, in fscache_submit_op() argument
251 object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_submit_op()
253 trace_fscache_op(object->cookie, op, fscache_op_submit); in fscache_submit_op()
258 spin_lock(&object->lock); in fscache_submit_op()
259 ASSERTCMP(object->n_ops, >=, object->n_in_progress); in fscache_submit_op()
260 ASSERTCMP(object->n_ops, >=, object->n_exclusive); in fscache_submit_op()
263 ostate = object->state; in fscache_submit_op()
267 flags = READ_ONCE(object->flags); in fscache_submit_op()
273 } else if (unlikely(fscache_cache_is_broken(object))) { in fscache_submit_op()
278 op->object = object; in fscache_submit_op()
279 object->n_ops++; in fscache_submit_op()
281 if (object->n_exclusive > 0) { in fscache_submit_op()
283 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
285 } else if (!list_empty(&object->pending_ops)) { in fscache_submit_op()
287 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
289 fscache_start_operations(object); in fscache_submit_op()
291 ASSERTCMP(object->n_exclusive, ==, 0); in fscache_submit_op()
292 fscache_run_op(object, op); in fscache_submit_op()
296 op->object = object; in fscache_submit_op()
297 object->n_ops++; in fscache_submit_op()
299 list_add_tail(&op->pend_link, &object->pending_ops); in fscache_submit_op()
307 fscache_report_unexpected_submission(object, op, ostate); in fscache_submit_op()
308 ASSERT(!fscache_object_is_active(object)); in fscache_submit_op()
314 spin_unlock(&object->lock); in fscache_submit_op()
322 void fscache_abort_object(struct fscache_object *object) in fscache_abort_object() argument
324 _enter("{OBJ%x}", object->debug_id); in fscache_abort_object()
326 fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); in fscache_abort_object()
333 void fscache_start_operations(struct fscache_object *object) in fscache_start_operations() argument
338 while (!list_empty(&object->pending_ops) && !stop) { in fscache_start_operations()
339 op = list_entry(object->pending_ops.next, in fscache_start_operations()
343 if (object->n_in_progress > 0) in fscache_start_operations()
348 fscache_run_op(object, op); in fscache_start_operations()
354 ASSERTCMP(object->n_in_progress, <=, object->n_ops); in fscache_start_operations()
357 object->n_in_progress, object->debug_id); in fscache_start_operations()
366 struct fscache_object *object = op->object; in fscache_cancel_op() local
370 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); in fscache_cancel_op()
372 trace_fscache_op(object->cookie, op, fscache_op_cancel); in fscache_cancel_op()
378 spin_lock(&object->lock); in fscache_cancel_op()
390 object->n_exclusive--; in fscache_cancel_op()
395 ASSERTCMP(object->n_in_progress, >, 0); in fscache_cancel_op()
397 object->n_exclusive--; in fscache_cancel_op()
398 object->n_in_progress--; in fscache_cancel_op()
399 if (object->n_in_progress == 0) in fscache_cancel_op()
400 fscache_start_operations(object); in fscache_cancel_op()
406 object->n_exclusive--; in fscache_cancel_op()
414 spin_unlock(&object->lock); in fscache_cancel_op()
422 void fscache_cancel_all_ops(struct fscache_object *object) in fscache_cancel_all_ops() argument
426 _enter("OBJ%x", object->debug_id); in fscache_cancel_all_ops()
428 spin_lock(&object->lock); in fscache_cancel_all_ops()
430 while (!list_empty(&object->pending_ops)) { in fscache_cancel_all_ops()
431 op = list_entry(object->pending_ops.next, in fscache_cancel_all_ops()
436 trace_fscache_op(object->cookie, op, fscache_op_cancel_all); in fscache_cancel_all_ops()
443 object->n_exclusive--; in fscache_cancel_all_ops()
447 cond_resched_lock(&object->lock); in fscache_cancel_all_ops()
450 spin_unlock(&object->lock); in fscache_cancel_all_ops()
459 struct fscache_object *object = op->object; in fscache_op_complete() local
461 _enter("OBJ%x", object->debug_id); in fscache_op_complete()
464 ASSERTCMP(object->n_in_progress, >, 0); in fscache_op_complete()
466 object->n_exclusive, >, 0); in fscache_op_complete()
468 object->n_in_progress, ==, 1); in fscache_op_complete()
470 spin_lock(&object->lock); in fscache_op_complete()
473 trace_fscache_op(object->cookie, op, fscache_op_completed); in fscache_op_complete()
477 trace_fscache_op(object->cookie, op, fscache_op_cancelled); in fscache_op_complete()
482 object->n_exclusive--; in fscache_op_complete()
483 object->n_in_progress--; in fscache_op_complete()
484 if (object->n_in_progress == 0) in fscache_op_complete()
485 fscache_start_operations(object); in fscache_op_complete()
487 spin_unlock(&object->lock); in fscache_op_complete()
498 struct fscache_object *object; in fscache_put_operation() local
502 op->object ? op->object->debug_id : 0, in fscache_put_operation()
510 trace_fscache_op(op->object ? op->object->cookie : NULL, op, fscache_op_put); in fscache_put_operation()
525 object = op->object; in fscache_put_operation()
526 if (likely(object)) { in fscache_put_operation()
528 atomic_dec(&object->n_reads); in fscache_put_operation()
530 fscache_unuse_cookie(object); in fscache_put_operation()
535 if (!spin_trylock(&object->lock)) { in fscache_put_operation()
539 cache = object->cache; in fscache_put_operation()
548 ASSERTCMP(object->n_ops, >, 0); in fscache_put_operation()
549 object->n_ops--; in fscache_put_operation()
550 if (object->n_ops == 0) in fscache_put_operation()
551 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_put_operation()
553 spin_unlock(&object->lock); in fscache_put_operation()
567 struct fscache_object *object; in fscache_operation_gc() local
586 object = op->object; in fscache_operation_gc()
587 trace_fscache_op(object->cookie, op, fscache_op_gc); in fscache_operation_gc()
589 spin_lock(&object->lock); in fscache_operation_gc()
592 object->debug_id, op->debug_id); in fscache_operation_gc()
598 ASSERTCMP(object->n_ops, >, 0); in fscache_operation_gc()
599 object->n_ops--; in fscache_operation_gc()
600 if (object->n_ops == 0) in fscache_operation_gc()
601 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); in fscache_operation_gc()
603 spin_unlock(&object->lock); in fscache_operation_gc()
624 op->object->debug_id, op->debug_id, atomic_read(&op->usage)); in fscache_op_work_func()
626 trace_fscache_op(op->object->cookie, op, fscache_op_work); in fscache_op_work_func()