Lines Matching refs:ce

220 static inline bool cache_entry_expired(const struct cache_entry *ce)  in cache_entry_expired()  argument
225 return timespec64_compare(&ts, &ce->etime) >= 0; in cache_entry_expired()
228 static inline void free_tgts(struct cache_entry *ce) in free_tgts() argument
232 list_for_each_entry_safe(t, n, &ce->tlist, list) { in free_tgts()
239 static inline void flush_cache_ent(struct cache_entry *ce) in flush_cache_ent() argument
241 hlist_del_init(&ce->hlist); in flush_cache_ent()
242 kfree(ce->path); in flush_cache_ent()
243 free_tgts(ce); in flush_cache_ent()
245 kmem_cache_free(cache_slab, ce); in flush_cache_ent()
255 struct cache_entry *ce; in flush_cache_ents() local
257 hlist_for_each_entry_safe(ce, n, l, hlist) { in flush_cache_ents()
258 if (!hlist_unhashed(&ce->hlist)) in flush_cache_ents()
259 flush_cache_ent(ce); in flush_cache_ents()
270 struct cache_entry *ce; in dfscache_proc_show() local
279 hlist_for_each_entry(ce, l, hlist) { in dfscache_proc_show()
280 if (hlist_unhashed(&ce->hlist)) in dfscache_proc_show()
285 ce->path, ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", in dfscache_proc_show()
286 ce->ttl, ce->etime.tv_nsec, ce->hdr_flags, ce->ref_flags, in dfscache_proc_show()
287 IS_DFS_INTERLINK(ce->hdr_flags) ? "yes" : "no", in dfscache_proc_show()
288 ce->path_consumed, cache_entry_expired(ce) ? "yes" : "no"); in dfscache_proc_show()
290 list_for_each_entry(t, &ce->tlist, list) { in dfscache_proc_show()
293 ce->tgthint == t ? " (target hint)" : ""); in dfscache_proc_show()
338 static inline void dump_tgts(const struct cache_entry *ce) in dump_tgts() argument
343 list_for_each_entry(t, &ce->tlist, list) { in dump_tgts()
345 ce->tgthint == t ? " (target hint)" : ""); in dump_tgts()
349 static inline void dump_ce(const struct cache_entry *ce) in dump_ce() argument
352 ce->path, in dump_ce()
353 ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", ce->ttl, in dump_ce()
354 ce->etime.tv_nsec, in dump_ce()
355 ce->hdr_flags, ce->ref_flags, in dump_ce()
356 IS_DFS_INTERLINK(ce->hdr_flags) ? "yes" : "no", in dump_ce()
357 ce->path_consumed, in dump_ce()
358 cache_entry_expired(ce) ? "yes" : "no"); in dump_ce()
359 dump_tgts(ce); in dump_ce()
449 static inline char *get_tgt_name(const struct cache_entry *ce) in get_tgt_name() argument
451 struct cache_dfs_tgt *t = ce->tgthint; in get_tgt_name()
492 struct cache_entry *ce, const char *tgthint) in copy_ref_data() argument
496 ce->ttl = max_t(int, refs[0].ttl, CACHE_MIN_TTL); in copy_ref_data()
497 ce->etime = get_expire_time(ce->ttl); in copy_ref_data()
498 ce->srvtype = refs[0].server_type; in copy_ref_data()
499 ce->hdr_flags = refs[0].flags; in copy_ref_data()
500 ce->ref_flags = refs[0].ref_flag; in copy_ref_data()
501 ce->path_consumed = refs[0].path_consumed; in copy_ref_data()
508 free_tgts(ce); in copy_ref_data()
512 list_add(&t->list, &ce->tlist); in copy_ref_data()
515 list_add_tail(&t->list, &ce->tlist); in copy_ref_data()
517 ce->numtgts++; in copy_ref_data()
520 ce->tgthint = list_first_entry_or_null(&ce->tlist, in copy_ref_data()
529 struct cache_entry *ce; in alloc_cache_entry() local
532 ce = kmem_cache_zalloc(cache_slab, GFP_KERNEL); in alloc_cache_entry()
533 if (!ce) in alloc_cache_entry()
536 ce->path = refs[0].path_name; in alloc_cache_entry()
539 INIT_HLIST_NODE(&ce->hlist); in alloc_cache_entry()
540 INIT_LIST_HEAD(&ce->tlist); in alloc_cache_entry()
542 rc = copy_ref_data(refs, numrefs, ce, NULL); in alloc_cache_entry()
544 kfree(ce->path); in alloc_cache_entry()
545 kmem_cache_free(cache_slab, ce); in alloc_cache_entry()
546 ce = ERR_PTR(rc); in alloc_cache_entry()
548 return ce; in alloc_cache_entry()
554 struct cache_entry *ce; in remove_oldest_entry_locked() local
562 hlist_for_each_entry(ce, l, hlist) { in remove_oldest_entry_locked()
563 if (hlist_unhashed(&ce->hlist)) in remove_oldest_entry_locked()
565 if (!to_del || timespec64_compare(&ce->etime, in remove_oldest_entry_locked()
567 to_del = ce; in remove_oldest_entry_locked()
585 struct cache_entry *ce; in add_cache_entry_locked() local
599 ce = alloc_cache_entry(refs, numrefs); in add_cache_entry_locked()
600 if (IS_ERR(ce)) in add_cache_entry_locked()
601 return PTR_ERR(ce); in add_cache_entry_locked()
605 cache_ttl = ce->ttl; in add_cache_entry_locked()
608 cache_ttl = min_t(int, cache_ttl, ce->ttl); in add_cache_entry_locked()
613 hlist_add_head(&ce->hlist, &cache_htable[hash]); in add_cache_entry_locked()
614 dump_ce(ce); in add_cache_entry_locked()
649 struct cache_entry *ce; in __lookup_cache_entry() local
651 hlist_for_each_entry(ce, &cache_htable[hash], hlist) { in __lookup_cache_entry()
652 if (dfs_path_equal(ce->path, strlen(ce->path), path, len)) { in __lookup_cache_entry()
653 dump_ce(ce); in __lookup_cache_entry()
654 return ce; in __lookup_cache_entry()
669 struct cache_entry *ce; in lookup_cache_entry() local
705 ce = __lookup_cache_entry(path, hash, len); in lookup_cache_entry()
706 if (!IS_ERR(ce)) in lookup_cache_entry()
707 return ce; in lookup_cache_entry()
732 static int update_cache_entry_locked(struct cache_entry *ce, const struct dfs_info3_param *refs, in update_cache_entry_locked() argument
740 if (ce->tgthint) { in update_cache_entry_locked()
741 s = ce->tgthint->name; in update_cache_entry_locked()
747 free_tgts(ce); in update_cache_entry_locked()
748 ce->numtgts = 0; in update_cache_entry_locked()
750 rc = copy_ref_data(refs, numrefs, ce, th); in update_cache_entry_locked()
796 struct cache_entry *ce; in cache_refresh_path() local
805 ce = lookup_cache_entry(path); in cache_refresh_path()
806 if (!IS_ERR(ce)) { in cache_refresh_path()
807 if (!cache_entry_expired(ce)) { in cache_refresh_path()
808 dump_ce(ce); in cache_refresh_path()
827 rc = update_cache_entry_locked(ce, refs, numrefs); in cache_refresh_path()
844 static int setup_referral(const char *path, struct cache_entry *ce, in setup_referral() argument
863 ref->path_consumed = ce->path_consumed; in setup_referral()
864 ref->ttl = ce->ttl; in setup_referral()
865 ref->server_type = ce->srvtype; in setup_referral()
866 ref->ref_flag = ce->ref_flags; in setup_referral()
867 ref->flags = ce->hdr_flags; in setup_referral()
878 static int get_targets(struct cache_entry *ce, struct dfs_cache_tgt_list *tl) in get_targets() argument
888 list_for_each_entry(t, &ce->tlist, list) { in get_targets()
903 if (ce->tgthint == t) in get_targets()
909 tl->tl_numtgts = ce->numtgts; in get_targets()
950 struct cache_entry *ce; in dfs_cache_find() local
962 ce = lookup_cache_entry(npath); in dfs_cache_find()
963 if (IS_ERR(ce)) { in dfs_cache_find()
965 rc = PTR_ERR(ce); in dfs_cache_find()
970 rc = setup_referral(path, ce, ref, get_tgt_name(ce)); in dfs_cache_find()
974 rc = get_targets(ce, tgt_list); in dfs_cache_find()
1003 struct cache_entry *ce; in dfs_cache_noreq_find() local
1009 ce = lookup_cache_entry(path); in dfs_cache_noreq_find()
1010 if (IS_ERR(ce)) { in dfs_cache_noreq_find()
1011 rc = PTR_ERR(ce); in dfs_cache_noreq_find()
1016 rc = setup_referral(path, ce, ref, get_tgt_name(ce)); in dfs_cache_noreq_find()
1020 rc = get_targets(ce, tgt_list); in dfs_cache_noreq_find()
1051 struct cache_entry *ce; in dfs_cache_update_tgthint() local
1066 ce = lookup_cache_entry(npath); in dfs_cache_update_tgthint()
1067 if (IS_ERR(ce)) { in dfs_cache_update_tgthint()
1068 rc = PTR_ERR(ce); in dfs_cache_update_tgthint()
1072 t = ce->tgthint; in dfs_cache_update_tgthint()
1077 list_for_each_entry(t, &ce->tlist, list) { in dfs_cache_update_tgthint()
1079 ce->tgthint = t; in dfs_cache_update_tgthint()
1110 struct cache_entry *ce; in dfs_cache_noreq_update_tgthint() local
1120 ce = lookup_cache_entry(path); in dfs_cache_noreq_update_tgthint()
1121 if (IS_ERR(ce)) { in dfs_cache_noreq_update_tgthint()
1122 rc = PTR_ERR(ce); in dfs_cache_noreq_update_tgthint()
1127 t = ce->tgthint; in dfs_cache_noreq_update_tgthint()
1132 list_for_each_entry(t, &ce->tlist, list) { in dfs_cache_noreq_update_tgthint()
1134 ce->tgthint = t; in dfs_cache_noreq_update_tgthint()
1160 struct cache_entry *ce; in dfs_cache_get_tgt_referral() local
1169 ce = lookup_cache_entry(path); in dfs_cache_get_tgt_referral()
1170 if (IS_ERR(ce)) { in dfs_cache_get_tgt_referral()
1171 rc = PTR_ERR(ce); in dfs_cache_get_tgt_referral()
1177 rc = setup_referral(path, ce, ref, it->it_name); in dfs_cache_get_tgt_referral()
1380 struct cache_entry *ce; in __refresh_tcon() local
1395 ce = lookup_cache_entry(path); in __refresh_tcon()
1396 needs_refresh = force_refresh || IS_ERR(ce) || cache_entry_expired(ce); in __refresh_tcon()
1397 if (!IS_ERR(ce)) { in __refresh_tcon()
1398 rc = get_targets(ce, &tl); in __refresh_tcon()
1418 ce = lookup_cache_entry(path); in __refresh_tcon()
1419 if (IS_ERR(ce)) in __refresh_tcon()
1421 else if (force_refresh || cache_entry_expired(ce)) in __refresh_tcon()
1422 update_cache_entry_locked(ce, refs, numrefs); in __refresh_tcon()
1574 struct cache_entry *ce; in refresh_cache() local
1587 hlist_for_each_entry(ce, l, hlist) { in refresh_cache()
1590 if (hlist_unhashed(&ce->hlist) || !cache_entry_expired(ce) || in refresh_cache()
1591 IS_ERR(find_ipc_from_server_path(sessions, ce->path))) in refresh_cache()
1593 ref_paths[count++] = kstrdup(ce->path, GFP_ATOMIC); in refresh_cache()
1619 ce = lookup_cache_entry(path); in refresh_cache()
1624 if (!IS_ERR(ce) && cache_entry_expired(ce)) in refresh_cache()
1625 update_cache_entry_locked(ce, refs, numrefs); in refresh_cache()