Lines Matching refs:rp

91 	struct nfsd_cacherep *rp;
93 rp = kmem_cache_alloc(drc_slab, GFP_KERNEL);
94 if (rp) {
95 rp->c_state = RC_UNUSED;
96 rp->c_type = RC_NOCACHE;
97 RB_CLEAR_NODE(&rp->c_node);
98 INIT_LIST_HEAD(&rp->c_lru);
100 memset(&rp->c_key, 0, sizeof(rp->c_key));
101 rp->c_key.k_xid = rqstp->rq_xid;
102 rp->c_key.k_proc = rqstp->rq_proc;
103 rpc_copy_addr((struct sockaddr *)&rp->c_key.k_addr, svc_addr(rqstp));
104 rpc_set_port((struct sockaddr *)&rp->c_key.k_addr, rpc_get_port(svc_addr(rqstp)));
105 rp->c_key.k_prot = rqstp->rq_prot;
106 rp->c_key.k_vers = rqstp->rq_vers;
107 rp->c_key.k_len = rqstp->rq_arg.len;
108 rp->c_key.k_csum = csum;
110 return rp;
113 static void nfsd_cacherep_free(struct nfsd_cacherep *rp)
115 if (rp->c_type == RC_REPLBUFF)
116 kfree(rp->c_replvec.iov_base);
117 kmem_cache_free(drc_slab, rp);
123 struct nfsd_cacherep *rp;
127 rp = list_first_entry(dispose, struct nfsd_cacherep, c_lru);
128 list_del(&rp->c_lru);
129 nfsd_cacherep_free(rp);
137 struct nfsd_cacherep *rp)
139 if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base)
140 nfsd_stats_drc_mem_usage_sub(nn, rp->c_replvec.iov_len);
141 if (rp->c_state != RC_UNUSED) {
142 rb_erase(&rp->c_node, &b->rb_head);
143 list_del(&rp->c_lru);
145 nfsd_stats_drc_mem_usage_sub(nn, sizeof(*rp));
150 nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp,
153 nfsd_cacherep_unlink_locked(nn, b, rp);
154 nfsd_cacherep_free(rp);
158 nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp,
162 nfsd_cacherep_unlink_locked(nn, b, rp);
164 nfsd_cacherep_free(rp);
239 struct nfsd_cacherep *rp;
247 rp = list_first_entry(head, struct nfsd_cacherep, c_lru);
249 rp, nn);
264 lru_put_end(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp)
266 rp->c_timestamp = jiffies;
267 list_move_tail(&rp->c_lru, &b->lru_head);
287 struct nfsd_cacherep *rp, *tmp;
293 list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) {
298 if (rp->c_state == RC_INPROG)
302 time_before(expiry, rp->c_timestamp))
305 nfsd_cacherep_unlink_locked(nn, b, rp);
306 list_add(&rp->c_lru, dispose);
425 const struct nfsd_cacherep *rp, struct nfsd_net *nn)
427 if (key->c_key.k_xid == rp->c_key.k_xid &&
428 key->c_key.k_csum != rp->c_key.k_csum) {
430 trace_nfsd_drc_mismatch(nn, key, rp);
433 return memcmp(&key->c_key, &rp->c_key, sizeof(key->c_key));
445 struct nfsd_cacherep *rp, *ret = key;
454 rp = rb_entry(parent, struct nfsd_cacherep, c_node);
456 cmp = nfsd_cache_key_cmp(key, rp, nn);
462 ret = rp;
506 struct nfsd_cacherep *rp, *found;
526 rp = nfsd_cacherep_alloc(rqstp, csum, nn);
527 if (!rp)
532 found = nfsd_cache_insert(b, rp, nn);
533 if (found != rp)
535 *cacherep = rp;
536 rp->c_state = RC_INPROG;
545 nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp));
550 nfsd_reply_cache_free_locked(NULL, rp, nn);
553 rp = found;
556 if (rp->c_state == RC_INPROG)
562 if (!test_bit(RQ_SECURE, &rqstp->rq_flags) && rp->c_secure)
566 switch (rp->c_type) {
570 xdr_stream_encode_be32(&rqstp->rq_res_stream, rp->c_replstat);
574 if (!nfsd_cache_append(rqstp, &rp->c_replvec))
579 WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type);
593 * @rp: IN: DRC entry for this request
611 void nfsd_cache_update(struct svc_rqst *rqstp, struct nfsd_cacherep *rp,
620 if (!rp)
623 b = nfsd_cache_bucket_find(rp->c_key.k_xid, nn);
630 nfsd_reply_cache_free(b, rp, nn);
638 rp->c_replstat = *statp;
641 cachv = &rp->c_replvec;
645 nfsd_reply_cache_free(b, rp, nn);
652 nfsd_reply_cache_free(b, rp, nn);
657 lru_put_end(b, rp);
658 rp->c_secure = test_bit(RQ_SECURE, &rqstp->rq_flags);
659 rp->c_type = cachetype;
660 rp->c_state = RC_DONE;