• Home
  • Raw
  • Download

Lines Matching refs:entry

77 	struct mb_cache_entry *entry, *dup;  in mb_cache_entry_create()  local
88 entry = kmem_cache_alloc(mb_entry_cache, mask); in mb_cache_entry_create()
89 if (!entry) in mb_cache_entry_create()
92 INIT_LIST_HEAD(&entry->e_list); in mb_cache_entry_create()
94 atomic_set(&entry->e_refcnt, 1); in mb_cache_entry_create()
95 entry->e_key = key; in mb_cache_entry_create()
96 entry->e_value = value; in mb_cache_entry_create()
97 entry->e_reusable = reusable; in mb_cache_entry_create()
98 entry->e_referenced = 0; in mb_cache_entry_create()
104 kmem_cache_free(mb_entry_cache, entry); in mb_cache_entry_create()
108 hlist_bl_add_head(&entry->e_hash_list, head); in mb_cache_entry_create()
112 list_add_tail(&entry->e_list, &cache->c_list); in mb_cache_entry_create()
114 atomic_inc(&entry->e_refcnt); in mb_cache_entry_create()
122 void __mb_cache_entry_free(struct mb_cache_entry *entry) in __mb_cache_entry_free() argument
124 kmem_cache_free(mb_entry_cache, entry); in __mb_cache_entry_free()
129 struct mb_cache_entry *entry, in __entry_find() argument
132 struct mb_cache_entry *old_entry = entry; in __entry_find()
138 if (entry && !hlist_bl_unhashed(&entry->e_hash_list)) in __entry_find()
139 node = entry->e_hash_list.next; in __entry_find()
143 entry = hlist_bl_entry(node, struct mb_cache_entry, in __entry_find()
145 if (entry->e_key == key && entry->e_reusable) { in __entry_find()
146 atomic_inc(&entry->e_refcnt); in __entry_find()
151 entry = NULL; in __entry_find()
157 return entry; in __entry_find()
186 struct mb_cache_entry *entry) in mb_cache_entry_find_next() argument
188 return __entry_find(cache, entry, entry->e_key); in mb_cache_entry_find_next()
203 struct mb_cache_entry *entry; in mb_cache_entry_get() local
207 hlist_bl_for_each_entry(entry, node, head, e_hash_list) { in mb_cache_entry_get()
208 if (entry->e_key == key && entry->e_value == value) { in mb_cache_entry_get()
209 atomic_inc(&entry->e_refcnt); in mb_cache_entry_get()
213 entry = NULL; in mb_cache_entry_get()
216 return entry; in mb_cache_entry_get()
231 struct mb_cache_entry *entry; in mb_cache_entry_delete() local
235 hlist_bl_for_each_entry(entry, node, head, e_hash_list) { in mb_cache_entry_delete()
236 if (entry->e_key == key && entry->e_value == value) { in mb_cache_entry_delete()
238 hlist_bl_del_init(&entry->e_hash_list); in mb_cache_entry_delete()
241 if (!list_empty(&entry->e_list)) { in mb_cache_entry_delete()
242 list_del_init(&entry->e_list); in mb_cache_entry_delete()
246 atomic_dec(&entry->e_refcnt); in mb_cache_entry_delete()
249 mb_cache_entry_put(cache, entry); in mb_cache_entry_delete()
264 struct mb_cache_entry *entry) in mb_cache_entry_touch() argument
266 entry->e_referenced = 1; in mb_cache_entry_touch()
283 struct mb_cache_entry *entry; in mb_cache_shrink() local
289 entry = list_first_entry(&cache->c_list, in mb_cache_shrink()
291 if (entry->e_referenced) { in mb_cache_shrink()
292 entry->e_referenced = 0; in mb_cache_shrink()
293 list_move_tail(&entry->e_list, &cache->c_list); in mb_cache_shrink()
296 list_del_init(&entry->e_list); in mb_cache_shrink()
303 head = mb_cache_entry_head(cache, entry->e_key); in mb_cache_shrink()
305 if (!hlist_bl_unhashed(&entry->e_hash_list)) { in mb_cache_shrink()
306 hlist_bl_del_init(&entry->e_hash_list); in mb_cache_shrink()
307 atomic_dec(&entry->e_refcnt); in mb_cache_shrink()
310 if (mb_cache_entry_put(cache, entry)) in mb_cache_shrink()
394 struct mb_cache_entry *entry, *next; in mb_cache_destroy() local
402 list_for_each_entry_safe(entry, next, &cache->c_list, e_list) { in mb_cache_destroy()
403 if (!hlist_bl_unhashed(&entry->e_hash_list)) { in mb_cache_destroy()
404 hlist_bl_del_init(&entry->e_hash_list); in mb_cache_destroy()
405 atomic_dec(&entry->e_refcnt); in mb_cache_destroy()
408 list_del(&entry->e_list); in mb_cache_destroy()
409 WARN_ON(atomic_read(&entry->e_refcnt) != 1); in mb_cache_destroy()
410 mb_cache_entry_put(cache, entry); in mb_cache_destroy()