Lines Matching full:rp

91 	struct svc_cacherep	*rp;  in nfsd_reply_cache_alloc()  local
93 rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); in nfsd_reply_cache_alloc()
94 if (rp) { in nfsd_reply_cache_alloc()
95 rp->c_state = RC_UNUSED; in nfsd_reply_cache_alloc()
96 rp->c_type = RC_NOCACHE; in nfsd_reply_cache_alloc()
97 RB_CLEAR_NODE(&rp->c_node); in nfsd_reply_cache_alloc()
98 INIT_LIST_HEAD(&rp->c_lru); in nfsd_reply_cache_alloc()
100 memset(&rp->c_key, 0, sizeof(rp->c_key)); in nfsd_reply_cache_alloc()
101 rp->c_key.k_xid = rqstp->rq_xid; in nfsd_reply_cache_alloc()
102 rp->c_key.k_proc = rqstp->rq_proc; in nfsd_reply_cache_alloc()
103 rpc_copy_addr((struct sockaddr *)&rp->c_key.k_addr, svc_addr(rqstp)); in nfsd_reply_cache_alloc()
104 rpc_set_port((struct sockaddr *)&rp->c_key.k_addr, rpc_get_port(svc_addr(rqstp))); in nfsd_reply_cache_alloc()
105 rp->c_key.k_prot = rqstp->rq_prot; in nfsd_reply_cache_alloc()
106 rp->c_key.k_vers = rqstp->rq_vers; in nfsd_reply_cache_alloc()
107 rp->c_key.k_len = rqstp->rq_arg.len; in nfsd_reply_cache_alloc()
108 rp->c_key.k_csum = csum; in nfsd_reply_cache_alloc()
110 return rp; in nfsd_reply_cache_alloc()
114 nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, in nfsd_reply_cache_free_locked() argument
117 if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) { in nfsd_reply_cache_free_locked()
118 nfsd_stats_drc_mem_usage_sub(nn, rp->c_replvec.iov_len); in nfsd_reply_cache_free_locked()
119 kfree(rp->c_replvec.iov_base); in nfsd_reply_cache_free_locked()
121 if (rp->c_state != RC_UNUSED) { in nfsd_reply_cache_free_locked()
122 rb_erase(&rp->c_node, &b->rb_head); in nfsd_reply_cache_free_locked()
123 list_del(&rp->c_lru); in nfsd_reply_cache_free_locked()
125 nfsd_stats_drc_mem_usage_sub(nn, sizeof(*rp)); in nfsd_reply_cache_free_locked()
127 kmem_cache_free(drc_slab, rp); in nfsd_reply_cache_free_locked()
131 nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, in nfsd_reply_cache_free() argument
135 nfsd_reply_cache_free_locked(b, rp, nn); in nfsd_reply_cache_free()
207 struct svc_cacherep *rp; in nfsd_reply_cache_shutdown() local
215 rp = list_first_entry(head, struct svc_cacherep, c_lru); in nfsd_reply_cache_shutdown()
217 rp, nn); in nfsd_reply_cache_shutdown()
233 lru_put_end(struct nfsd_drc_bucket *b, struct svc_cacherep *rp) in lru_put_end() argument
235 rp->c_timestamp = jiffies; in lru_put_end()
236 list_move_tail(&rp->c_lru, &b->lru_head); in lru_put_end()
250 struct svc_cacherep *rp, *tmp; in prune_bucket() local
253 list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) { in prune_bucket()
258 if (rp->c_state == RC_INPROG) in prune_bucket()
261 time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) in prune_bucket()
263 nfsd_reply_cache_free_locked(b, rp, nn); in prune_bucket()
349 const struct svc_cacherep *rp, struct nfsd_net *nn) in nfsd_cache_key_cmp() argument
351 if (key->c_key.k_xid == rp->c_key.k_xid && in nfsd_cache_key_cmp()
352 key->c_key.k_csum != rp->c_key.k_csum) { in nfsd_cache_key_cmp()
354 trace_nfsd_drc_mismatch(nn, key, rp); in nfsd_cache_key_cmp()
357 return memcmp(&key->c_key, &rp->c_key, sizeof(key->c_key)); in nfsd_cache_key_cmp()
369 struct svc_cacherep *rp, *ret = key; in nfsd_cache_insert() local
378 rp = rb_entry(parent, struct svc_cacherep, c_node); in nfsd_cache_insert()
380 cmp = nfsd_cache_key_cmp(key, rp, nn); in nfsd_cache_insert()
386 ret = rp; in nfsd_cache_insert()
426 struct svc_cacherep *rp, *found; in nfsd_cache_lookup() local
445 rp = nfsd_reply_cache_alloc(rqstp, csum, nn); in nfsd_cache_lookup()
446 if (!rp) in nfsd_cache_lookup()
451 found = nfsd_cache_insert(b, rp, nn); in nfsd_cache_lookup()
452 if (found != rp) 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()
471 nfsd_reply_cache_free_locked(NULL, rp, nn); in nfsd_cache_lookup()
474 rp = found; in nfsd_cache_lookup()
477 if (rp->c_state == RC_INPROG) in nfsd_cache_lookup()
483 if (!test_bit(RQ_SECURE, &rqstp->rq_flags) && rp->c_secure) in nfsd_cache_lookup()
487 switch (rp->c_type) { in nfsd_cache_lookup()
491 svc_putu32(&rqstp->rq_res.head[0], rp->c_replstat); in nfsd_cache_lookup()
495 if (!nfsd_cache_append(rqstp, &rp->c_replvec)) in nfsd_cache_lookup()
500 WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); in nfsd_cache_lookup()
531 struct svc_cacherep *rp = rqstp->rq_cacherep; in nfsd_cache_update() local
537 if (!rp) in nfsd_cache_update()
540 b = nfsd_cache_bucket_find(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()