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()
334 static inline void fscache_mark_object_dead(struct fscache_object *object) in fscache_mark_object_dead() argument
336 spin_lock(&object->lock); in fscache_mark_object_dead()
337 clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); in fscache_mark_object_dead()
338 spin_unlock(&object->lock); in fscache_mark_object_dead()
344 static const struct fscache_state *fscache_abort_initialisation(struct fscache_object *object, in fscache_abort_initialisation() argument
347 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_abort_initialisation()
349 object->oob_event_mask = 0; in fscache_abort_initialisation()
350 fscache_dequeue_object(object); in fscache_abort_initialisation()
361 static const struct fscache_state *fscache_initialise_object(struct fscache_object *object, in fscache_initialise_object() argument
367 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_initialise_object()
369 ASSERT(list_empty(&object->dep_link)); in fscache_initialise_object()
371 parent = object->parent; in fscache_initialise_object()
395 object->cache->ops->grab_object(object)) { in fscache_initialise_object()
396 list_add(&object->dep_link, &parent->dependents); in fscache_initialise_object()
416 static const struct fscache_state *fscache_parent_ready(struct fscache_object *object, in fscache_parent_ready() argument
419 struct fscache_object *parent = object->parent; in fscache_parent_ready()
421 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_parent_ready()
428 object->lookup_jif = jiffies; in fscache_parent_ready()
440 static const struct fscache_state *fscache_look_up_object(struct fscache_object *object, in fscache_look_up_object() argument
443 struct fscache_cookie *cookie = object->cookie; in fscache_look_up_object()
444 struct fscache_object *parent = object->parent; in fscache_look_up_object()
447 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_look_up_object()
449 object->oob_table = fscache_osm_lookup_oob; in fscache_look_up_object()
459 test_bit(FSCACHE_IOERROR, &object->cache->flags) || in fscache_look_up_object()
460 !fscache_use_cookie(object)) { in fscache_look_up_object()
466 cookie->def->name, object->cache->tag->name); in fscache_look_up_object()
470 ret = object->cache->ops->lookup_object(object); in fscache_look_up_object()
473 fscache_unuse_cookie(object); in fscache_look_up_object()
499 void fscache_object_lookup_negative(struct fscache_object *object) in fscache_object_lookup_negative() argument
501 struct fscache_cookie *cookie = object->cookie; in fscache_object_lookup_negative()
503 _enter("{OBJ%x,%s}", object->debug_id, object->state->name); in fscache_object_lookup_negative()
505 if (!test_and_set_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_object_lookup_negative()
532 void fscache_obtained_object(struct fscache_object *object) in fscache_obtained_object() argument
534 struct fscache_cookie *cookie = object->cookie; in fscache_obtained_object()
536 _enter("{OBJ%x,%s}", object->debug_id, object->state->name); in fscache_obtained_object()
540 if (!test_and_set_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags)) { in fscache_obtained_object()
556 set_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags); in fscache_obtained_object()
564 static const struct fscache_state *fscache_object_available(struct fscache_object *object, in fscache_object_available() argument
567 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_object_available()
569 object->oob_table = fscache_osm_run_oob; in fscache_object_available()
571 spin_lock(&object->lock); in fscache_object_available()
573 fscache_done_parent_op(object); in fscache_object_available()
574 if (object->n_in_progress == 0) { in fscache_object_available()
575 if (object->n_ops > 0) { in fscache_object_available()
576 ASSERTCMP(object->n_ops, >=, object->n_obj_ops); in fscache_object_available()
577 fscache_start_operations(object); in fscache_object_available()
579 ASSERT(list_empty(&object->pending_ops)); in fscache_object_available()
582 spin_unlock(&object->lock); in fscache_object_available()
585 object->cache->ops->lookup_complete(object); in fscache_object_available()
588 fscache_hist(fscache_obj_instantiate_histogram, object->lookup_jif); in fscache_object_available()
598 static const struct fscache_state *fscache_jumpstart_dependents(struct fscache_object *object, in fscache_jumpstart_dependents() argument
601 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_jumpstart_dependents()
603 if (!fscache_enqueue_dependents(object, FSCACHE_OBJECT_EV_PARENT_READY)) in fscache_jumpstart_dependents()
611 static const struct fscache_state *fscache_lookup_failure(struct fscache_object *object, in fscache_lookup_failure() argument
616 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_lookup_failure()
618 object->oob_event_mask = 0; in fscache_lookup_failure()
621 object->cache->ops->lookup_complete(object); in fscache_lookup_failure()
624 set_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->flags); in fscache_lookup_failure()
626 cookie = object->cookie; in fscache_lookup_failure()
631 fscache_done_parent_op(object); in fscache_lookup_failure()
639 static const struct fscache_state *fscache_kill_object(struct fscache_object *object, in fscache_kill_object() argument
643 object->debug_id, object->n_ops, object->n_children, event); in fscache_kill_object()
645 fscache_mark_object_dead(object); in fscache_kill_object()
646 object->oob_event_mask = 0; in fscache_kill_object()
648 if (list_empty(&object->dependents) && in fscache_kill_object()
649 object->n_ops == 0 && in fscache_kill_object()
650 object->n_children == 0) in fscache_kill_object()
653 if (object->n_in_progress == 0) { in fscache_kill_object()
654 spin_lock(&object->lock); in fscache_kill_object()
655 if (object->n_ops > 0 && object->n_in_progress == 0) in fscache_kill_object()
656 fscache_start_operations(object); in fscache_kill_object()
657 spin_unlock(&object->lock); in fscache_kill_object()
660 if (!list_empty(&object->dependents)) in fscache_kill_object()
669 static const struct fscache_state *fscache_kill_dependents(struct fscache_object *object, in fscache_kill_dependents() argument
672 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_kill_dependents()
674 if (!fscache_enqueue_dependents(object, FSCACHE_OBJECT_EV_KILL)) in fscache_kill_dependents()
682 static const struct fscache_state *fscache_drop_object(struct fscache_object *object, in fscache_drop_object() argument
685 struct fscache_object *parent = object->parent; in fscache_drop_object()
686 struct fscache_cookie *cookie = object->cookie; in fscache_drop_object()
687 struct fscache_cache *cache = object->cache; in fscache_drop_object()
690 _enter("{OBJ%x,%d},%d", object->debug_id, object->n_children, event); in fscache_drop_object()
693 ASSERT(!hlist_unhashed(&object->cookie_link)); in fscache_drop_object()
699 hlist_del_init(&object->cookie_link); in fscache_drop_object()
711 spin_lock(&object->lock); in fscache_drop_object()
712 spin_unlock(&object->lock); in fscache_drop_object()
716 list_del_init(&object->cache_link); in fscache_drop_object()
720 cache->ops->drop_object(object); in fscache_drop_object()
733 object->parent = NULL; in fscache_drop_object()
737 fscache_put_object(object); in fscache_drop_object()
747 static int fscache_get_object(struct fscache_object *object) in fscache_get_object() argument
752 ret = object->cache->ops->grab_object(object) ? 0 : -EAGAIN; in fscache_get_object()
760 static void fscache_put_object(struct fscache_object *object) in fscache_put_object() argument
763 object->cache->ops->put_object(object); in fscache_put_object()
773 void fscache_object_destroy(struct fscache_object *object) in fscache_object_destroy() argument
775 fscache_objlist_remove(object); in fscache_object_destroy()
778 fscache_cookie_put(object->cookie); in fscache_object_destroy()
779 object->cookie = NULL; in fscache_object_destroy()
786 void fscache_enqueue_object(struct fscache_object *object) in fscache_enqueue_object() argument
788 _enter("{OBJ%x}", object->debug_id); in fscache_enqueue_object()
790 if (fscache_get_object(object) >= 0) { in fscache_enqueue_object()
794 if (queue_work(fscache_object_wq, &object->work)) { in fscache_enqueue_object()
798 fscache_put_object(object); in fscache_enqueue_object()
840 static bool fscache_enqueue_dependents(struct fscache_object *object, int event) in fscache_enqueue_dependents() argument
845 _enter("{OBJ%x}", object->debug_id); in fscache_enqueue_dependents()
847 if (list_empty(&object->dependents)) in fscache_enqueue_dependents()
850 spin_lock(&object->lock); in fscache_enqueue_dependents()
852 while (!list_empty(&object->dependents)) { in fscache_enqueue_dependents()
853 dep = list_entry(object->dependents.next, in fscache_enqueue_dependents()
860 if (!list_empty(&object->dependents) && need_resched()) { in fscache_enqueue_dependents()
866 spin_unlock(&object->lock); in fscache_enqueue_dependents()
873 static void fscache_dequeue_object(struct fscache_object *object) in fscache_dequeue_object() argument
875 _enter("{OBJ%x}", object->debug_id); in fscache_dequeue_object()
877 if (!list_empty(&object->dep_link)) { in fscache_dequeue_object()
878 spin_lock(&object->parent->lock); in fscache_dequeue_object()
879 list_del_init(&object->dep_link); in fscache_dequeue_object()
880 spin_unlock(&object->parent->lock); in fscache_dequeue_object()
897 enum fscache_checkaux fscache_check_aux(struct fscache_object *object, in fscache_check_aux() argument
902 if (!object->cookie->def->check_aux) { in fscache_check_aux()
907 result = object->cookie->def->check_aux(object->cookie->netfs_data, in fscache_check_aux()
936 static const struct fscache_state *_fscache_invalidate_object(struct fscache_object *object, in _fscache_invalidate_object() argument
940 struct fscache_cookie *cookie = object->cookie; in _fscache_invalidate_object()
942 _enter("{OBJ%x},%d", object->debug_id, event); in _fscache_invalidate_object()
947 if (!fscache_use_cookie(object)) { in _fscache_invalidate_object()
948 ASSERT(object->cookie->stores.rnode == NULL); in _fscache_invalidate_object()
949 set_bit(FSCACHE_OBJECT_RETIRED, &object->flags); in _fscache_invalidate_object()
956 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); in _fscache_invalidate_object()
957 fscache_cancel_all_ops(object); in _fscache_invalidate_object()
964 fscache_operation_init(op, object->cache->ops->invalidate_object, in _fscache_invalidate_object()
971 if (fscache_submit_exclusive_op(object, op) < 0) in _fscache_invalidate_object()
991 fscache_mark_object_dead(object); in _fscache_invalidate_object()
992 fscache_unuse_cookie(object); in _fscache_invalidate_object()
997 fscache_mark_object_dead(object); in _fscache_invalidate_object()
999 fscache_unuse_cookie(object); in _fscache_invalidate_object()
1005 static const struct fscache_state *fscache_invalidate_object(struct fscache_object *object, in fscache_invalidate_object() argument
1012 s = _fscache_invalidate_object(object, event); in fscache_invalidate_object()
1020 static const struct fscache_state *fscache_update_object(struct fscache_object *object, in fscache_update_object() argument
1023 _enter("{OBJ%x},%d", object->debug_id, event); in fscache_update_object()
1027 object->cache->ops->update_object(object); in fscache_update_object()
1041 void fscache_object_retrying_stale(struct fscache_object *object) in fscache_object_retrying_stale() argument
1055 void fscache_object_mark_killed(struct fscache_object *object, in fscache_object_mark_killed() argument
1058 if (test_and_set_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->flags)) { in fscache_object_mark_killed()
1060 object->cache->identifier); in fscache_object_mark_killed()