• Home
  • Raw
  • Download

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
220 rp = list_first_entry(head, struct svc_cacherep, c_lru); in nfsd_reply_cache_shutdown()
222 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()
340 const struct svc_cacherep *rp, struct nfsd_net *nn) in nfsd_cache_key_cmp() argument
342 if (key->c_key.k_xid == rp->c_key.k_xid && in nfsd_cache_key_cmp()
343 key->c_key.k_csum != rp->c_key.k_csum) { in nfsd_cache_key_cmp()
345 trace_nfsd_drc_mismatch(nn, key, rp); in nfsd_cache_key_cmp()
348 return memcmp(&key->c_key, &rp->c_key, sizeof(key->c_key)); in nfsd_cache_key_cmp()
360 struct svc_cacherep *rp, *ret = key; in nfsd_cache_insert() local
369 rp = rb_entry(parent, struct svc_cacherep, c_node); in nfsd_cache_insert()
371 cmp = nfsd_cache_key_cmp(key, rp, nn); in nfsd_cache_insert()
377 ret = rp; in nfsd_cache_insert()
417 struct svc_cacherep *rp, *found; in nfsd_cache_lookup() local
437 rp = nfsd_reply_cache_alloc(rqstp, csum, nn); in nfsd_cache_lookup()
438 if (!rp) in nfsd_cache_lookup()
442 found = nfsd_cache_insert(b, rp, nn); in nfsd_cache_lookup()
443 if (found != rp) { in nfsd_cache_lookup()
444 nfsd_reply_cache_free_locked(NULL, rp, nn); in nfsd_cache_lookup()
445 rp = found; in nfsd_cache_lookup()
450 rqstp->rq_cacherep = rp; in nfsd_cache_lookup()
451 rp->c_state = RC_INPROG; in nfsd_cache_lookup()
454 nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp)); in nfsd_cache_lookup()
470 if (rp->c_state == RC_INPROG) in nfsd_cache_lookup()
476 if (!test_bit(RQ_SECURE, &rqstp->rq_flags) && rp->c_secure) in nfsd_cache_lookup()
480 switch (rp->c_type) { in nfsd_cache_lookup()
484 svc_putu32(&rqstp->rq_res.head[0], rp->c_replstat); in nfsd_cache_lookup()
488 if (!nfsd_cache_append(rqstp, &rp->c_replvec)) in nfsd_cache_lookup()
493 WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); in nfsd_cache_lookup()
524 struct svc_cacherep *rp = rqstp->rq_cacherep; in nfsd_cache_update() local
531 if (!rp) in nfsd_cache_update()
534 hash = nfsd_cache_hash(rp->c_key.k_xid, nn); in nfsd_cache_update()
542 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
550 rp->c_replstat = *statp; in nfsd_cache_update()
553 cachv = &rp->c_replvec; in nfsd_cache_update()
557 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
564 nfsd_reply_cache_free(b, rp, nn); in nfsd_cache_update()
569 lru_put_end(b, rp); in nfsd_cache_update()
570 rp->c_secure = test_bit(RQ_SECURE, &rqstp->rq_flags); in nfsd_cache_update()
571 rp->c_type = cachetype; in nfsd_cache_update()
572 rp->c_state = RC_DONE; in nfsd_cache_update()