Lines Matching refs:rp

97 	struct svc_cacherep	*rp;  in nfsd_reply_cache_alloc()  local
99 rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); in nfsd_reply_cache_alloc()
100 if (rp) { in nfsd_reply_cache_alloc()
101 rp->c_state = RC_UNUSED; in nfsd_reply_cache_alloc()
102 rp->c_type = RC_NOCACHE; in nfsd_reply_cache_alloc()
103 RB_CLEAR_NODE(&rp->c_node); in nfsd_reply_cache_alloc()
104 INIT_LIST_HEAD(&rp->c_lru); in nfsd_reply_cache_alloc()
106 memset(&rp->c_key, 0, sizeof(rp->c_key)); in nfsd_reply_cache_alloc()
107 rp->c_key.k_xid = rqstp->rq_xid; in nfsd_reply_cache_alloc()
108 rp->c_key.k_proc = rqstp->rq_proc; in nfsd_reply_cache_alloc()
109 rpc_copy_addr((struct sockaddr *)&rp->c_key.k_addr, svc_addr(rqstp)); in nfsd_reply_cache_alloc()
110 rpc_set_port((struct sockaddr *)&rp->c_key.k_addr, rpc_get_port(svc_addr(rqstp))); in nfsd_reply_cache_alloc()
111 rp->c_key.k_prot = rqstp->rq_prot; in nfsd_reply_cache_alloc()
112 rp->c_key.k_vers = rqstp->rq_vers; in nfsd_reply_cache_alloc()
113 rp->c_key.k_len = rqstp->rq_arg.len; in nfsd_reply_cache_alloc()
114 rp->c_key.k_csum = csum; in nfsd_reply_cache_alloc()
116 return rp; in nfsd_reply_cache_alloc()
120 nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, in nfsd_reply_cache_free_locked() argument
123 if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) { in nfsd_reply_cache_free_locked()
124 nfsd_stats_drc_mem_usage_sub(nn, rp->c_replvec.iov_len); in nfsd_reply_cache_free_locked()
125 kfree(rp->c_replvec.iov_base); in nfsd_reply_cache_free_locked()
127 if (rp->c_state != RC_UNUSED) { in nfsd_reply_cache_free_locked()
128 rb_erase(&rp->c_node, &b->rb_head); in nfsd_reply_cache_free_locked()
129 list_del(&rp->c_lru); in nfsd_reply_cache_free_locked()
131 nfsd_stats_drc_mem_usage_sub(nn, sizeof(*rp)); in nfsd_reply_cache_free_locked()
133 kmem_cache_free(drc_slab, rp); in nfsd_reply_cache_free_locked()
137 nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, in nfsd_reply_cache_free() argument
141 nfsd_reply_cache_free_locked(b, rp, nn); in nfsd_reply_cache_free()
212 struct svc_cacherep *rp; in nfsd_reply_cache_shutdown() local
221 rp = list_first_entry(head, struct svc_cacherep, c_lru); in nfsd_reply_cache_shutdown()
223 rp, nn); in nfsd_reply_cache_shutdown()
238 lru_put_end(struct nfsd_drc_bucket *b, struct svc_cacherep *rp) in lru_put_end() argument
240 rp->c_timestamp = jiffies; in lru_put_end()
241 list_move_tail(&rp->c_lru, &b->lru_head); in lru_put_end()
247 struct svc_cacherep *rp, *tmp; in prune_bucket() local
250 list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) { in prune_bucket()
255 if (rp->c_state == RC_INPROG) in prune_bucket()
258 time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) in prune_bucket()
260 nfsd_reply_cache_free_locked(b, rp, nn); in prune_bucket()
346 const struct svc_cacherep *rp, struct nfsd_net *nn) in nfsd_cache_key_cmp() argument
348 if (key->c_key.k_xid == rp->c_key.k_xid && in nfsd_cache_key_cmp()
349 key->c_key.k_csum != rp->c_key.k_csum) { in nfsd_cache_key_cmp()
351 trace_nfsd_drc_mismatch(nn, key, rp); in nfsd_cache_key_cmp()
354 return memcmp(&key->c_key, &rp->c_key, sizeof(key->c_key)); in nfsd_cache_key_cmp()
366 struct svc_cacherep *rp, *ret = key; in nfsd_cache_insert() local
375 rp = rb_entry(parent, struct svc_cacherep, c_node); in nfsd_cache_insert()
377 cmp = nfsd_cache_key_cmp(key, rp, nn); in nfsd_cache_insert()
383 ret = rp; in nfsd_cache_insert()
423 struct svc_cacherep *rp, *found; in nfsd_cache_lookup() local
443 rp = nfsd_reply_cache_alloc(rqstp, csum, nn); in nfsd_cache_lookup()
444 if (!rp) in nfsd_cache_lookup()
448 found = nfsd_cache_insert(b, rp, nn); in nfsd_cache_lookup()
449 if (found != rp) { in nfsd_cache_lookup()
450 nfsd_reply_cache_free_locked(NULL, rp, nn); in nfsd_cache_lookup()
451 rp = found; in nfsd_cache_lookup()
456 rqstp->rq_cacherep = rp; in nfsd_cache_lookup()
457 rp->c_state = RC_INPROG; in nfsd_cache_lookup()
460 nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp)); in nfsd_cache_lookup()
475 if (rp->c_state == RC_INPROG) in nfsd_cache_lookup()
481 if (!test_bit(RQ_SECURE, &rqstp->rq_flags) && rp->c_secure) in nfsd_cache_lookup()
485 switch (rp->c_type) { in nfsd_cache_lookup()
489 svc_putu32(&rqstp->rq_res.head[0], rp->c_replstat); in nfsd_cache_lookup()
493 if (!nfsd_cache_append(rqstp, &rp->c_replvec)) in nfsd_cache_lookup()
498 WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); in nfsd_cache_lookup()
529 struct svc_cacherep *rp = rqstp->rq_cacherep; in nfsd_cache_update() local
536 if (!rp) in nfsd_cache_update()
539 hash = nfsd_cache_hash(rp->c_key.k_xid, nn); in nfsd_cache_update()
547 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
555 rp->c_replstat = *statp; in nfsd_cache_update()
558 cachv = &rp->c_replvec; in nfsd_cache_update()
562 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
569 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
574 lru_put_end(b, rp); in nfsd_cache_update()
575 rp->c_secure = test_bit(RQ_SECURE, &rqstp->rq_flags); in nfsd_cache_update()
576 rp->c_type = cachetype; in nfsd_cache_update()
577 rp->c_state = RC_DONE; in nfsd_cache_update()