Lines Matching refs:detail

43 static void cache_init(struct cache_head *h, struct cache_detail *detail)
50 if (now <= detail->flush_time)
52 now = detail->flush_time + 1;
57 struct cache_detail *detail);
59 static struct cache_head *sunrpc_cache_find_rcu(struct cache_detail *detail,
63 struct hlist_head *head = &detail->hash_table[hash];
68 if (!detail->match(tmp, key))
71 cache_is_expired(detail, tmp))
97 static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,
102 struct hlist_head *head = &detail->hash_table[hash];
104 new = detail->alloc();
111 cache_init(new, detail);
112 detail->init(new, key);
114 spin_lock(&detail->hash_lock);
118 lockdep_is_held(&detail->hash_lock)) {
119 if (!detail->match(tmp, key))
122 cache_is_expired(detail, tmp)) {
123 sunrpc_begin_cache_remove_entry(tmp, detail);
124 trace_cache_entry_expired(detail, tmp);
129 spin_unlock(&detail->hash_lock);
130 cache_put(new, detail);
135 detail->entries++;
137 spin_unlock(&detail->hash_lock);
140 sunrpc_end_cache_remove_entry(freeme, detail);
144 struct cache_head *sunrpc_cache_lookup_rcu(struct cache_detail *detail,
149 ret = sunrpc_cache_find_rcu(detail, key, hash);
153 return sunrpc_cache_add_entry(detail, key, hash);
157 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch);
160 struct cache_detail *detail)
163 if (now <= detail->flush_time)
165 now = detail->flush_time + 1;
173 struct cache_detail *detail)
177 cache_dequeue(detail, head);
181 static void cache_make_negative(struct cache_detail *detail,
185 trace_cache_entry_make_negative(detail, h);
188 static void cache_entry_update(struct cache_detail *detail,
193 detail->update(h, new);
194 trace_cache_entry_update(detail, h);
196 cache_make_negative(detail, h);
200 struct cache_head *sunrpc_cache_update(struct cache_detail *detail,
210 spin_lock(&detail->hash_lock);
212 cache_entry_update(detail, old, new);
213 cache_fresh_locked(old, new->expiry_time, detail);
214 spin_unlock(&detail->hash_lock);
215 cache_fresh_unlocked(old, detail);
218 spin_unlock(&detail->hash_lock);
221 tmp = detail->alloc();
223 cache_put(old, detail);
226 cache_init(tmp, detail);
227 detail->init(tmp, old);
229 spin_lock(&detail->hash_lock);
230 cache_entry_update(detail, tmp, new);
231 hlist_add_head(&tmp->cache_list, &detail->hash_table[hash]);
232 detail->entries++;
234 cache_fresh_locked(tmp, new->expiry_time, detail);
235 cache_fresh_locked(old, 0, detail);
236 spin_unlock(&detail->hash_lock);
237 cache_fresh_unlocked(tmp, detail);
238 cache_fresh_unlocked(old, detail);
239 cache_put(old, detail);
265 static int try_to_negate_entry(struct cache_detail *detail, struct cache_head *h)
269 spin_lock(&detail->hash_lock);
272 cache_make_negative(detail, h);
274 detail);
277 spin_unlock(&detail->hash_lock);
278 cache_fresh_unlocked(h, detail);
296 int cache_check(struct cache_detail *detail,
316 switch (detail->cache_upcall(detail, h)) {
318 rv = try_to_negate_entry(detail, h);
321 cache_fresh_unlocked(h, detail);
338 cache_put(h, detail);
529 void cache_purge(struct cache_detail *detail)
535 spin_lock(&detail->hash_lock);
536 if (!detail->entries) {
537 spin_unlock(&detail->hash_lock);
541 dprintk("RPC: %d entries in %s cache\n", detail->entries, detail->name);
542 for (i = 0; i < detail->hash_size; i++) {
543 head = &detail->hash_table[i];
547 sunrpc_begin_cache_remove_entry(ch, detail);
548 spin_unlock(&detail->hash_lock);
549 sunrpc_end_cache_remove_entry(ch, detail);
550 spin_lock(&detail->hash_lock);
553 spin_unlock(&detail->hash_lock);
799 static int cache_request(struct cache_detail *detail,
805 detail->cache_request(detail, crq->item, &bp, &len);
1087 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch)
1095 list_for_each_entry_safe(cq, tmp, &detail->queue, list)
1111 cache_put(cr->item, detail);
1176 static void warn_no_listener(struct cache_detail *detail)
1178 if (detail->last_warn != detail->last_close) {
1179 detail->last_warn = detail->last_close;
1180 if (detail->warn_no_listener)
1181 detail->warn_no_listener(detail, detail->last_close != 0);
1185 static bool cache_listeners_exist(struct cache_detail *detail)
1187 if (atomic_read(&detail->writers))
1189 if (detail->last_close == 0)
1192 if (detail->last_close < seconds_since_boot() - 30)
1208 static int cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
1235 list_add_tail(&crq->q.list, &detail->queue);
1236 trace_cache_entry_upcall(detail, h);
1249 int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
1253 return cache_pipe_upcall(detail, h);
1257 int sunrpc_cache_pipe_upcall_timeout(struct cache_detail *detail,
1260 if (!cache_listeners_exist(detail)) {
1261 warn_no_listener(detail);
1262 trace_cache_entry_no_listener(detail, h);
1265 return sunrpc_cache_pipe_upcall(detail, h);