Lines Matching defs:detail

45 static void cache_init(struct cache_head *h, struct cache_detail *detail)
52 if (now <= detail->flush_time)
54 now = detail->flush_time + 1;
59 struct cache_detail *detail);
61 static struct cache_head *sunrpc_cache_find_rcu(struct cache_detail *detail,
65 struct hlist_head *head = &detail->hash_table[hash];
70 if (!detail->match(tmp, key))
73 cache_is_expired(detail, tmp))
99 static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,
104 struct hlist_head *head = &detail->hash_table[hash];
106 new = detail->alloc();
113 cache_init(new, detail);
114 detail->init(new, key);
116 spin_lock(&detail->hash_lock);
120 lockdep_is_held(&detail->hash_lock)) {
121 if (!detail->match(tmp, key))
124 cache_is_expired(detail, tmp)) {
125 sunrpc_begin_cache_remove_entry(tmp, detail);
126 trace_cache_entry_expired(detail, tmp);
131 spin_unlock(&detail->hash_lock);
132 cache_put(new, detail);
137 detail->entries++;
139 spin_unlock(&detail->hash_lock);
142 sunrpc_end_cache_remove_entry(freeme, detail);
146 struct cache_head *sunrpc_cache_lookup_rcu(struct cache_detail *detail,
151 ret = sunrpc_cache_find_rcu(detail, key, hash);
155 return sunrpc_cache_add_entry(detail, key, hash);
159 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch);
162 struct cache_detail *detail)
165 if (now <= detail->flush_time)
167 now = detail->flush_time + 1;
175 struct cache_detail *detail)
179 cache_dequeue(detail, head);
183 static void cache_make_negative(struct cache_detail *detail,
187 trace_cache_entry_make_negative(detail, h);
190 static void cache_entry_update(struct cache_detail *detail,
195 detail->update(h, new);
196 trace_cache_entry_update(detail, h);
198 cache_make_negative(detail, h);
202 struct cache_head *sunrpc_cache_update(struct cache_detail *detail,
212 spin_lock(&detail->hash_lock);
214 cache_entry_update(detail, old, new);
215 cache_fresh_locked(old, new->expiry_time, detail);
216 spin_unlock(&detail->hash_lock);
217 cache_fresh_unlocked(old, detail);
220 spin_unlock(&detail->hash_lock);
223 tmp = detail->alloc();
225 cache_put(old, detail);
228 cache_init(tmp, detail);
229 detail->init(tmp, old);
231 spin_lock(&detail->hash_lock);
232 cache_entry_update(detail, tmp, new);
233 hlist_add_head(&tmp->cache_list, &detail->hash_table[hash]);
234 detail->entries++;
236 cache_fresh_locked(tmp, new->expiry_time, detail);
237 cache_fresh_locked(old, 0, detail);
238 spin_unlock(&detail->hash_lock);
239 cache_fresh_unlocked(tmp, detail);
240 cache_fresh_unlocked(old, detail);
241 cache_put(old, detail);
267 static int try_to_negate_entry(struct cache_detail *detail, struct cache_head *h)
271 spin_lock(&detail->hash_lock);
274 cache_make_negative(detail, h);
276 detail);
279 spin_unlock(&detail->hash_lock);
280 cache_fresh_unlocked(h, detail);
298 int cache_check(struct cache_detail *detail,
318 switch (detail->cache_upcall(detail, h)) {
320 rv = try_to_negate_entry(detail, h);
323 cache_fresh_unlocked(h, detail);
340 cache_put(h, detail);
531 void cache_purge(struct cache_detail *detail)
537 spin_lock(&detail->hash_lock);
538 if (!detail->entries) {
539 spin_unlock(&detail->hash_lock);
543 dprintk("RPC: %d entries in %s cache\n", detail->entries, detail->name);
544 for (i = 0; i < detail->hash_size; i++) {
545 head = &detail->hash_table[i];
549 sunrpc_begin_cache_remove_entry(ch, detail);
550 spin_unlock(&detail->hash_lock);
551 sunrpc_end_cache_remove_entry(ch, detail);
552 spin_lock(&detail->hash_lock);
555 spin_unlock(&detail->hash_lock);
814 static int cache_request(struct cache_detail *detail,
820 detail->cache_request(detail, crq->item, &bp, &len);
1084 static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch)
1092 list_for_each_entry_safe(cq, tmp, &detail->queue, list)
1108 cache_put(cr->item, detail);
1173 static void warn_no_listener(struct cache_detail *detail)
1175 if (detail->last_warn != detail->last_close) {
1176 detail->last_warn = detail->last_close;
1177 if (detail->warn_no_listener)
1178 detail->warn_no_listener(detail, detail->last_close != 0);
1182 static bool cache_listeners_exist(struct cache_detail *detail)
1184 if (atomic_read(&detail->writers))
1186 if (detail->last_close == 0)
1189 if (detail->last_close < seconds_since_boot() - 30)
1205 static int cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
1232 list_add_tail(&crq->q.list, &detail->queue);
1233 trace_cache_entry_upcall(detail, h);
1246 int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
1250 return cache_pipe_upcall(detail, h);
1254 int sunrpc_cache_pipe_upcall_timeout(struct cache_detail *detail,
1257 if (!cache_listeners_exist(detail)) {
1258 warn_no_listener(detail);
1259 trace_cache_entry_no_listener(detail, h);
1262 return sunrpc_cache_pipe_upcall(detail, h);