Lines Matching refs:object
149 static inline void fscache_done_parent_op(struct fscache_object *object) in fscache_done_parent_op() argument
151 struct fscache_object *parent = object->parent; in fscache_done_parent_op()
154 object->debug_id, parent->debug_id, parent->n_ops); in fscache_done_parent_op()
167 static void fscache_object_sm_dispatcher(struct fscache_object *object) in fscache_object_sm_dispatcher() argument
174 ASSERT(object != NULL); in fscache_object_sm_dispatcher()
177 object->debug_id, object->state->name, object->events); in fscache_object_sm_dispatcher()
179 event_mask = object->event_mask; in fscache_object_sm_dispatcher()
181 object->event_mask = 0; /* Mask normal event handling */ in fscache_object_sm_dispatcher()
182 state = object->state; in fscache_object_sm_dispatcher()
184 events = object->events; in fscache_object_sm_dispatcher()
187 if (events & object->oob_event_mask) { in fscache_object_sm_dispatcher()
189 object->debug_id, events & object->oob_event_mask); in fscache_object_sm_dispatcher()
190 for (t = object->oob_table; t->events; t++) { in fscache_object_sm_dispatcher()
195 __clear_bit(event, &object->oob_event_mask); in fscache_object_sm_dispatcher()
196 clear_bit(event, &object->events); in fscache_object_sm_dispatcher()
209 clear_bit(event, &object->events); in fscache_object_sm_dispatcher()
211 object->debug_id, event, in fscache_object_sm_dispatcher()
213 object->state = state = new_state; in fscache_object_sm_dispatcher()
226 _debug("{OBJ%x} exec %s", object->debug_id, state->name); in fscache_object_sm_dispatcher()
228 new_state = state->work(object, event); in fscache_object_sm_dispatcher()
231 _debug("{OBJ%x} %s notrans", object->debug_id, state->name); in fscache_object_sm_dispatcher()
232 fscache_enqueue_object(object); in fscache_object_sm_dispatcher()
233 event_mask = object->oob_event_mask; in fscache_object_sm_dispatcher()
238 object->debug_id, state->name, new_state->name); in fscache_object_sm_dispatcher()
239 object->state = state = new_state; in fscache_object_sm_dispatcher()
250 event_mask = object->oob_event_mask; in fscache_object_sm_dispatcher()
255 object->event_mask = event_mask; in fscache_object_sm_dispatcher()
257 events = object->events; in fscache_object_sm_dispatcher()
268 struct fscache_object *object = in fscache_object_work_func() local
272 _enter("{OBJ%x}", object->debug_id); in fscache_object_work_func()
275 fscache_object_sm_dispatcher(object); in fscache_object_work_func()
277 fscache_put_object(object); in fscache_object_work_func()
291 void fscache_object_init(struct fscache_object *object, in fscache_object_init() argument
299 object->state = STATE(WAIT_FOR_INIT); in fscache_object_init()
300 object->oob_table = fscache_osm_init_oob; in fscache_object_init()
301 object->flags = 1 << FSCACHE_OBJECT_IS_LIVE; in fscache_object_init()
302 spin_lock_init(&object->lock); in fscache_object_init()
303 INIT_LIST_HEAD(&object->cache_link); in fscache_object_init()
304 INIT_HLIST_NODE(&object->cookie_link); in fscache_object_init()
305 INIT_WORK(&object->work, fscache_object_work_func); in fscache_object_init()
306 INIT_LIST_HEAD(&object->dependents); in fscache_object_init()
307 INIT_LIST_HEAD(&object->dep_link); in fscache_object_init()
308 INIT_LIST_HEAD(&object->pending_ops); in fscache_object_init()
309 object->n_children = 0; in fscache_object_init()
310 object->n_ops = object->n_in_progress = object->n_exclusive = 0; in fscache_object_init()
311 object->events = 0; in fscache_object_init()
312 object->store_limit = 0; in fscache_object_init()
313 object->store_limit_l = 0; in fscache_object_init()
314 object->cache = cache; in fscache_object_init()
315 object->cookie = cookie; in fscache_object_init()
316 object->parent = NULL; in fscache_object_init()
318 RB_CLEAR_NODE(&object->objlist_link); in fscache_object_init()
321 object->oob_event_mask = 0; in fscache_object_init()
322 for (t = object->oob_table; t->events; t++) in fscache_object_init()
323 object->oob_event_mask |= t->events; in fscache_object_init()
324 object->event_mask = object->oob_event_mask; in fscache_object_init()
325 for (t = object->state->transitions; t->events; t++) in fscache_object_init()
326 object->event_mask |= t->events; in fscache_object_init()
333 static const struct fscache_state *fscache_abort_initialisation(struct fscache_object *object, in fscache_abort_initialisation() argument
336 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_abort_initialisation()
338 object->oob_event_mask = 0; in fscache_abort_initialisation()
339 fscache_dequeue_object(object); in fscache_abort_initialisation()
350 static const struct fscache_state *fscache_initialise_object(struct fscache_object *object, in fscache_initialise_object() argument
356 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_initialise_object()
358 ASSERT(list_empty(&object->dep_link)); in fscache_initialise_object()
360 parent = object->parent; in fscache_initialise_object()
384 object->cache->ops->grab_object(object)) { in fscache_initialise_object()
385 list_add(&object->dep_link, &parent->dependents); in fscache_initialise_object()
405 static const struct fscache_state *fscache_parent_ready(struct fscache_object *object, in fscache_parent_ready() argument
408 struct fscache_object *parent = object->parent; in fscache_parent_ready()
410 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_parent_ready()
417 object->lookup_jif = jiffies; in fscache_parent_ready()
429 static const struct fscache_state *fscache_look_up_object(struct fscache_object *object, in fscache_look_up_object() argument
432 struct fscache_cookie *cookie = object->cookie; in fscache_look_up_object()
433 struct fscache_object *parent = object->parent; in fscache_look_up_object()
436 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_look_up_object()
438 object->oob_table = fscache_osm_lookup_oob; in fscache_look_up_object()
448 test_bit(FSCACHE_IOERROR, &object->cache->flags) || in fscache_look_up_object()
449 !fscache_use_cookie(object)) { in fscache_look_up_object()
455 cookie->def->name, object->cache->tag->name); in fscache_look_up_object()
459 ret = object->cache->ops->lookup_object(object); in fscache_look_up_object()
462 fscache_unuse_cookie(object); in fscache_look_up_object()
488 void fscache_object_lookup_negative(struct fscache_object *object) in fscache_object_lookup_negative() argument
490 struct fscache_cookie *cookie = object->cookie; in fscache_object_lookup_negative()
492 _enter("{OBJ%x,%s}", object->debug_id, object->state->name); in fscache_object_lookup_negative()
494 if (!test_and_set_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_object_lookup_negative()
521 void fscache_obtained_object(struct fscache_object *object) in fscache_obtained_object() argument
523 struct fscache_cookie *cookie = object->cookie; in fscache_obtained_object()
525 _enter("{OBJ%x,%s}", object->debug_id, object->state->name); in fscache_obtained_object()
529 if (!test_and_set_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_obtained_object()
545 set_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags); in fscache_obtained_object()
553 static const struct fscache_state *fscache_object_available(struct fscache_object *object, in fscache_object_available() argument
556 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_object_available()
558 object->oob_table = fscache_osm_run_oob; in fscache_object_available()
560 spin_lock(&object->lock); in fscache_object_available()
562 fscache_done_parent_op(object); in fscache_object_available()
563 if (object->n_in_progress == 0) { in fscache_object_available()
564 if (object->n_ops > 0) { in fscache_object_available()
565 ASSERTCMP(object->n_ops, >=, object->n_obj_ops); in fscache_object_available()
566 fscache_start_operations(object); in fscache_object_available()
568 ASSERT(list_empty(&object->pending_ops)); in fscache_object_available()
571 spin_unlock(&object->lock); in fscache_object_available()
574 object->cache->ops->lookup_complete(object); in fscache_object_available()
577 fscache_hist(fscache_obj_instantiate_histogram, object->lookup_jif); in fscache_object_available()
587 static const struct fscache_state *fscache_jumpstart_dependents(struct fscache_object *object, in fscache_jumpstart_dependents() argument
590 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_jumpstart_dependents()
592 if (!fscache_enqueue_dependents(object, FSCACHE_OBJECT_EV_PARENT_READY)) in fscache_jumpstart_dependents()
600 static const struct fscache_state *fscache_lookup_failure(struct fscache_object *object, in fscache_lookup_failure() argument
605 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_lookup_failure()
607 object->oob_event_mask = 0; in fscache_lookup_failure()
610 object->cache->ops->lookup_complete(object); in fscache_lookup_failure()
613 cookie = object->cookie; in fscache_lookup_failure()
618 fscache_done_parent_op(object); in fscache_lookup_failure()
626 static const struct fscache_state *fscache_kill_object(struct fscache_object *object, in fscache_kill_object() argument
630 object->debug_id, object->n_ops, object->n_children, event); in fscache_kill_object()
632 clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); in fscache_kill_object()
633 object->oob_event_mask = 0; in fscache_kill_object()
635 if (list_empty(&object->dependents) && in fscache_kill_object()
636 object->n_ops == 0 && in fscache_kill_object()
637 object->n_children == 0) in fscache_kill_object()
640 if (object->n_in_progress == 0) { in fscache_kill_object()
641 spin_lock(&object->lock); in fscache_kill_object()
642 if (object->n_ops > 0 && object->n_in_progress == 0) in fscache_kill_object()
643 fscache_start_operations(object); in fscache_kill_object()
644 spin_unlock(&object->lock); in fscache_kill_object()
647 if (!list_empty(&object->dependents)) in fscache_kill_object()
656 static const struct fscache_state *fscache_kill_dependents(struct fscache_object *object, in fscache_kill_dependents() argument
659 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_kill_dependents()
661 if (!fscache_enqueue_dependents(object, FSCACHE_OBJECT_EV_KILL)) in fscache_kill_dependents()
669 static const struct fscache_state *fscache_drop_object(struct fscache_object *object, in fscache_drop_object() argument
672 struct fscache_object *parent = object->parent; in fscache_drop_object()
673 struct fscache_cookie *cookie = object->cookie; in fscache_drop_object()
674 struct fscache_cache *cache = object->cache; in fscache_drop_object()
677 _enter("{OBJ%x,%d},%d", object->debug_id, object->n_children, event); in fscache_drop_object()
680 ASSERT(!hlist_unhashed(&object->cookie_link)); in fscache_drop_object()
686 hlist_del_init(&object->cookie_link); in fscache_drop_object()
698 spin_lock(&object->lock); in fscache_drop_object()
699 spin_unlock(&object->lock); in fscache_drop_object()
703 list_del_init(&object->cache_link); in fscache_drop_object()
707 cache->ops->drop_object(object); in fscache_drop_object()
720 object->parent = NULL; in fscache_drop_object()
724 fscache_put_object(object); in fscache_drop_object()
734 static int fscache_get_object(struct fscache_object *object) in fscache_get_object() argument
739 ret = object->cache->ops->grab_object(object) ? 0 : -EAGAIN; in fscache_get_object()
747 static void fscache_put_object(struct fscache_object *object) in fscache_put_object() argument
750 object->cache->ops->put_object(object); in fscache_put_object()
760 void fscache_object_destroy(struct fscache_object *object) in fscache_object_destroy() argument
762 fscache_objlist_remove(object); in fscache_object_destroy()
765 fscache_cookie_put(object->cookie); in fscache_object_destroy()
766 object->cookie = NULL; in fscache_object_destroy()
773 void fscache_enqueue_object(struct fscache_object *object) in fscache_enqueue_object() argument
775 _enter("{OBJ%x}", object->debug_id); in fscache_enqueue_object()
777 if (fscache_get_object(object) >= 0) { in fscache_enqueue_object()
781 if (queue_work(fscache_object_wq, &object->work)) { in fscache_enqueue_object()
785 fscache_put_object(object); in fscache_enqueue_object()
827 static bool fscache_enqueue_dependents(struct fscache_object *object, int event) in fscache_enqueue_dependents() argument
832 _enter("{OBJ%x}", object->debug_id); in fscache_enqueue_dependents()
834 if (list_empty(&object->dependents)) in fscache_enqueue_dependents()
837 spin_lock(&object->lock); in fscache_enqueue_dependents()
839 while (!list_empty(&object->dependents)) { in fscache_enqueue_dependents()
840 dep = list_entry(object->dependents.next, in fscache_enqueue_dependents()
847 if (!list_empty(&object->dependents) && need_resched()) { in fscache_enqueue_dependents()
853 spin_unlock(&object->lock); in fscache_enqueue_dependents()
860 static void fscache_dequeue_object(struct fscache_object *object) in fscache_dequeue_object() argument
862 _enter("{OBJ%x}", object->debug_id); in fscache_dequeue_object()
864 if (!list_empty(&object->dep_link)) { in fscache_dequeue_object()
865 spin_lock(&object->parent->lock); in fscache_dequeue_object()
866 list_del_init(&object->dep_link); in fscache_dequeue_object()
867 spin_unlock(&object->parent->lock); in fscache_dequeue_object()
884 enum fscache_checkaux fscache_check_aux(struct fscache_object *object, in fscache_check_aux() argument
889 if (!object->cookie->def->check_aux) { in fscache_check_aux()
894 result = object->cookie->def->check_aux(object->cookie->netfs_data, in fscache_check_aux()
923 static const struct fscache_state *_fscache_invalidate_object(struct fscache_object *object, in _fscache_invalidate_object() argument
927 struct fscache_cookie *cookie = object->cookie; in _fscache_invalidate_object()
929 _enter("{OBJ%x},%d", object->debug_id, event); in _fscache_invalidate_object()
934 if (!fscache_use_cookie(object)) { in _fscache_invalidate_object()
935 ASSERT(object->cookie->stores.rnode == NULL); in _fscache_invalidate_object()
936 set_bit(FSCACHE_OBJECT_RETIRED, &object->flags); in _fscache_invalidate_object()
943 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in _fscache_invalidate_object()
944 fscache_cancel_all_ops(object); in _fscache_invalidate_object()
951 fscache_operation_init(op, object->cache->ops->invalidate_object, NULL); in _fscache_invalidate_object()
957 if (fscache_submit_exclusive_op(object, op) < 0) in _fscache_invalidate_object()
977 clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); in _fscache_invalidate_object()
978 fscache_unuse_cookie(object); in _fscache_invalidate_object()
983 clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); in _fscache_invalidate_object()
985 fscache_unuse_cookie(object); in _fscache_invalidate_object()
991 static const struct fscache_state *fscache_invalidate_object(struct fscache_object *object, in fscache_invalidate_object() argument
998 s = _fscache_invalidate_object(object, event); in fscache_invalidate_object()
1006 static const struct fscache_state *fscache_update_object(struct fscache_object *object, in fscache_update_object() argument
1009 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_update_object()
1013 object->cache->ops->update_object(object); in fscache_update_object()