Lines Matching refs:detail
44 static void cache_init(struct cache_head *h, struct cache_detail *detail) in cache_init() argument
51 if (now <= detail->flush_time) in cache_init()
53 now = detail->flush_time + 1; in cache_init()
57 struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, in sunrpc_cache_lookup() argument
63 head = &detail->hash_table[hash]; in sunrpc_cache_lookup()
65 read_lock(&detail->hash_lock); in sunrpc_cache_lookup()
68 if (detail->match(tmp, key)) { in sunrpc_cache_lookup()
69 if (cache_is_expired(detail, tmp)) in sunrpc_cache_lookup()
73 read_unlock(&detail->hash_lock); in sunrpc_cache_lookup()
77 read_unlock(&detail->hash_lock); in sunrpc_cache_lookup()
80 new = detail->alloc(); in sunrpc_cache_lookup()
87 cache_init(new, detail); in sunrpc_cache_lookup()
88 detail->init(new, key); in sunrpc_cache_lookup()
90 write_lock(&detail->hash_lock); in sunrpc_cache_lookup()
94 if (detail->match(tmp, key)) { in sunrpc_cache_lookup()
95 if (cache_is_expired(detail, tmp)) { in sunrpc_cache_lookup()
97 detail->entries --; in sunrpc_cache_lookup()
102 write_unlock(&detail->hash_lock); in sunrpc_cache_lookup()
103 cache_put(new, detail); in sunrpc_cache_lookup()
109 detail->entries++; in sunrpc_cache_lookup()
111 write_unlock(&detail->hash_lock); in sunrpc_cache_lookup()
114 cache_put(freeme, detail); in sunrpc_cache_lookup()
120 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch);
123 struct cache_detail *detail) in cache_fresh_locked() argument
126 if (now <= detail->flush_time) in cache_fresh_locked()
128 now = detail->flush_time + 1; in cache_fresh_locked()
136 struct cache_detail *detail) in cache_fresh_unlocked() argument
140 cache_dequeue(detail, head); in cache_fresh_unlocked()
144 struct cache_head *sunrpc_cache_update(struct cache_detail *detail, in sunrpc_cache_update() argument
154 write_lock(&detail->hash_lock); in sunrpc_cache_update()
159 detail->update(old, new); in sunrpc_cache_update()
160 cache_fresh_locked(old, new->expiry_time, detail); in sunrpc_cache_update()
161 write_unlock(&detail->hash_lock); in sunrpc_cache_update()
162 cache_fresh_unlocked(old, detail); in sunrpc_cache_update()
165 write_unlock(&detail->hash_lock); in sunrpc_cache_update()
168 tmp = detail->alloc(); in sunrpc_cache_update()
170 cache_put(old, detail); in sunrpc_cache_update()
173 cache_init(tmp, detail); in sunrpc_cache_update()
174 detail->init(tmp, old); in sunrpc_cache_update()
176 write_lock(&detail->hash_lock); in sunrpc_cache_update()
180 detail->update(tmp, new); in sunrpc_cache_update()
181 hlist_add_head(&tmp->cache_list, &detail->hash_table[hash]); in sunrpc_cache_update()
182 detail->entries++; in sunrpc_cache_update()
184 cache_fresh_locked(tmp, new->expiry_time, detail); in sunrpc_cache_update()
185 cache_fresh_locked(old, 0, detail); in sunrpc_cache_update()
186 write_unlock(&detail->hash_lock); in sunrpc_cache_update()
187 cache_fresh_unlocked(tmp, detail); in sunrpc_cache_update()
188 cache_fresh_unlocked(old, detail); in sunrpc_cache_update()
189 cache_put(old, detail); in sunrpc_cache_update()
222 static int try_to_negate_entry(struct cache_detail *detail, struct cache_head *h) in try_to_negate_entry() argument
226 write_lock(&detail->hash_lock); in try_to_negate_entry()
231 detail); in try_to_negate_entry()
234 write_unlock(&detail->hash_lock); in try_to_negate_entry()
235 cache_fresh_unlocked(h, detail); in try_to_negate_entry()
253 int cache_check(struct cache_detail *detail, in cache_check() argument
274 switch (cache_make_upcall(detail, h)) { in cache_check()
276 rv = try_to_negate_entry(detail, h); in cache_check()
279 cache_fresh_unlocked(h, detail); in cache_check()
297 cache_put(h, detail); in cache_check()
497 void cache_purge(struct cache_detail *detail) in cache_purge() argument
500 if (detail->flush_time >= now) in cache_purge()
501 now = detail->flush_time + 1; in cache_purge()
503 detail->flush_time = now; in cache_purge()
504 detail->nextcheck = seconds_since_boot(); in cache_purge()
751 static int cache_request(struct cache_detail *detail, in cache_request() argument
757 detail->cache_request(detail, crq->item, &bp, &len); in cache_request()
1035 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch) in cache_dequeue() argument
1043 list_for_each_entry_safe(cq, tmp, &detail->queue, list) in cache_dequeue()
1059 cache_put(cr->item, detail); in cache_dequeue()
1124 static void warn_no_listener(struct cache_detail *detail) in warn_no_listener() argument
1126 if (detail->last_warn != detail->last_close) { in warn_no_listener()
1127 detail->last_warn = detail->last_close; in warn_no_listener()
1128 if (detail->warn_no_listener) in warn_no_listener()
1129 detail->warn_no_listener(detail, detail->last_close != 0); in warn_no_listener()
1133 static bool cache_listeners_exist(struct cache_detail *detail) in cache_listeners_exist() argument
1135 if (atomic_read(&detail->readers)) in cache_listeners_exist()
1137 if (detail->last_close == 0) in cache_listeners_exist()
1140 if (detail->last_close < seconds_since_boot() - 30) in cache_listeners_exist()
1156 int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h) in sunrpc_cache_pipe_upcall() argument
1163 if (!detail->cache_request) in sunrpc_cache_pipe_upcall()
1166 if (!cache_listeners_exist(detail)) { in sunrpc_cache_pipe_upcall()
1167 warn_no_listener(detail); in sunrpc_cache_pipe_upcall()
1191 list_add_tail(&crq->q.list, &detail->queue); in sunrpc_cache_pipe_upcall()