Lines Matching refs:entry
54 struct mb2_cache_entry *entry, *dup; in mb2_cache_entry_create() local
58 entry = kmem_cache_alloc(mb2_entry_cache, mask); in mb2_cache_entry_create()
59 if (!entry) in mb2_cache_entry_create()
62 INIT_LIST_HEAD(&entry->e_lru_list); in mb2_cache_entry_create()
64 atomic_set(&entry->e_refcnt, 1); in mb2_cache_entry_create()
65 entry->e_key = key; in mb2_cache_entry_create()
66 entry->e_block = block; in mb2_cache_entry_create()
68 entry->e_hash_list_head = head; in mb2_cache_entry_create()
73 kmem_cache_free(mb2_entry_cache, entry); in mb2_cache_entry_create()
77 hlist_bl_add_head(&entry->e_hash_list, head); in mb2_cache_entry_create()
81 list_add_tail(&entry->e_lru_list, &cache->c_lru_list); in mb2_cache_entry_create()
83 atomic_inc(&entry->e_refcnt); in mb2_cache_entry_create()
91 void __mb2_cache_entry_free(struct mb2_cache_entry *entry) in __mb2_cache_entry_free() argument
93 kmem_cache_free(mb2_entry_cache, entry); in __mb2_cache_entry_free()
98 struct mb2_cache_entry *entry, in __entry_find() argument
101 struct mb2_cache_entry *old_entry = entry; in __entry_find()
105 if (entry) in __entry_find()
106 head = entry->e_hash_list_head; in __entry_find()
110 if (entry && !hlist_bl_unhashed(&entry->e_hash_list)) in __entry_find()
111 node = entry->e_hash_list.next; in __entry_find()
115 entry = hlist_bl_entry(node, struct mb2_cache_entry, in __entry_find()
117 if (entry->e_key == key) { in __entry_find()
118 atomic_inc(&entry->e_refcnt); in __entry_find()
123 entry = NULL; in __entry_find()
129 return entry; in __entry_find()
158 struct mb2_cache_entry *entry) in mb2_cache_entry_find_next() argument
160 return __entry_find(cache, entry, entry->e_key); in mb2_cache_entry_find_next()
176 struct mb2_cache_entry *entry; in mb2_cache_entry_delete_block() local
180 hlist_bl_for_each_entry(entry, node, head, e_hash_list) { in mb2_cache_entry_delete_block()
181 if (entry->e_key == key && entry->e_block == block) { in mb2_cache_entry_delete_block()
183 hlist_bl_del_init(&entry->e_hash_list); in mb2_cache_entry_delete_block()
186 if (!list_empty(&entry->e_lru_list)) { in mb2_cache_entry_delete_block()
187 list_del_init(&entry->e_lru_list); in mb2_cache_entry_delete_block()
189 atomic_dec(&entry->e_refcnt); in mb2_cache_entry_delete_block()
192 mb2_cache_entry_put(cache, entry); in mb2_cache_entry_delete_block()
207 struct mb2_cache_entry *entry) in mb2_cache_entry_touch() argument
210 if (!list_empty(&entry->e_lru_list)) in mb2_cache_entry_touch()
211 list_move_tail(&cache->c_lru_list, &entry->e_lru_list); in mb2_cache_entry_touch()
232 struct mb2_cache_entry *entry; in mb2_cache_scan() local
238 entry = list_first_entry(&cache->c_lru_list, in mb2_cache_scan()
240 list_del_init(&entry->e_lru_list); in mb2_cache_scan()
247 head = entry->e_hash_list_head; in mb2_cache_scan()
249 if (!hlist_bl_unhashed(&entry->e_hash_list)) { in mb2_cache_scan()
250 hlist_bl_del_init(&entry->e_hash_list); in mb2_cache_scan()
251 atomic_dec(&entry->e_refcnt); in mb2_cache_scan()
254 if (mb2_cache_entry_put(cache, entry)) in mb2_cache_scan()
316 struct mb2_cache_entry *entry, *next; in mb2_cache_destroy() local
324 list_for_each_entry_safe(entry, next, &cache->c_lru_list, e_lru_list) { in mb2_cache_destroy()
325 if (!hlist_bl_unhashed(&entry->e_hash_list)) { in mb2_cache_destroy()
326 hlist_bl_del_init(&entry->e_hash_list); in mb2_cache_destroy()
327 atomic_dec(&entry->e_refcnt); in mb2_cache_destroy()
330 list_del(&entry->e_lru_list); in mb2_cache_destroy()
331 WARN_ON(atomic_read(&entry->e_refcnt) != 1); in mb2_cache_destroy()
332 mb2_cache_entry_put(cache, entry); in mb2_cache_destroy()