Lines Matching refs:rp
132 struct svc_cacherep *rp; in nfsd_reply_cache_alloc() local
134 rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); in nfsd_reply_cache_alloc()
135 if (rp) { in nfsd_reply_cache_alloc()
136 rp->c_state = RC_UNUSED; in nfsd_reply_cache_alloc()
137 rp->c_type = RC_NOCACHE; in nfsd_reply_cache_alloc()
138 INIT_LIST_HEAD(&rp->c_lru); in nfsd_reply_cache_alloc()
140 return rp; in nfsd_reply_cache_alloc()
144 nfsd_reply_cache_free_locked(struct svc_cacherep *rp) in nfsd_reply_cache_free_locked() argument
146 if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) { in nfsd_reply_cache_free_locked()
147 drc_mem_usage -= rp->c_replvec.iov_len; in nfsd_reply_cache_free_locked()
148 kfree(rp->c_replvec.iov_base); in nfsd_reply_cache_free_locked()
150 list_del(&rp->c_lru); in nfsd_reply_cache_free_locked()
152 drc_mem_usage -= sizeof(*rp); in nfsd_reply_cache_free_locked()
153 kmem_cache_free(drc_slab, rp); in nfsd_reply_cache_free_locked()
157 nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp) in nfsd_reply_cache_free() argument
160 nfsd_reply_cache_free_locked(rp); in nfsd_reply_cache_free()
202 struct svc_cacherep *rp; in nfsd_reply_cache_shutdown() local
211 rp = list_first_entry(head, struct svc_cacherep, c_lru); in nfsd_reply_cache_shutdown()
212 nfsd_reply_cache_free_locked(rp); in nfsd_reply_cache_shutdown()
231 lru_put_end(struct nfsd_drc_bucket *b, struct svc_cacherep *rp) in lru_put_end() argument
233 rp->c_timestamp = jiffies; in lru_put_end()
234 list_move_tail(&rp->c_lru, &b->lru_head); in lru_put_end()
241 struct svc_cacherep *rp, *tmp; in prune_bucket() local
244 list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) { in prune_bucket()
249 if (rp->c_state == RC_INPROG) in prune_bucket()
252 time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) in prune_bucket()
254 nfsd_reply_cache_free_locked(rp); in prune_bucket()
343 nfsd_cache_match(struct svc_rqst *rqstp, __wsum csum, struct svc_cacherep *rp) in nfsd_cache_match() argument
346 if (rqstp->rq_xid != rp->c_xid) in nfsd_cache_match()
349 if (csum != rp->c_csum) { in nfsd_cache_match()
355 if (rqstp->rq_proc != rp->c_proc || in nfsd_cache_match()
356 rqstp->rq_prot != rp->c_prot || in nfsd_cache_match()
357 rqstp->rq_vers != rp->c_vers || in nfsd_cache_match()
358 rqstp->rq_arg.len != rp->c_len || in nfsd_cache_match()
359 !rpc_cmp_addr(svc_addr(rqstp), (struct sockaddr *)&rp->c_addr) || in nfsd_cache_match()
360 rpc_get_port(svc_addr(rqstp)) != rpc_get_port((struct sockaddr *)&rp->c_addr)) in nfsd_cache_match()
375 struct svc_cacherep *rp, *ret = NULL; in nfsd_cache_search() local
379 list_for_each_entry(rp, rh, c_lru) { in nfsd_cache_search()
381 if (nfsd_cache_match(rqstp, csum, rp)) { in nfsd_cache_search()
382 ret = rp; in nfsd_cache_search()
411 struct svc_cacherep *rp, *found; in nfsd_cache_lookup() local
435 rp = nfsd_reply_cache_alloc(); in nfsd_cache_lookup()
437 if (likely(rp)) { in nfsd_cache_lookup()
439 drc_mem_usage += sizeof(*rp); in nfsd_cache_lookup()
447 if (likely(rp)) in nfsd_cache_lookup()
448 nfsd_reply_cache_free_locked(rp); in nfsd_cache_lookup()
449 rp = found; in nfsd_cache_lookup()
453 if (!rp) { in nfsd_cache_lookup()
459 rqstp->rq_cacherep = rp; in nfsd_cache_lookup()
460 rp->c_state = RC_INPROG; in nfsd_cache_lookup()
461 rp->c_xid = xid; in nfsd_cache_lookup()
462 rp->c_proc = proc; in nfsd_cache_lookup()
463 rpc_copy_addr((struct sockaddr *)&rp->c_addr, svc_addr(rqstp)); in nfsd_cache_lookup()
464 rpc_set_port((struct sockaddr *)&rp->c_addr, rpc_get_port(svc_addr(rqstp))); in nfsd_cache_lookup()
465 rp->c_prot = proto; in nfsd_cache_lookup()
466 rp->c_vers = vers; in nfsd_cache_lookup()
467 rp->c_len = rqstp->rq_arg.len; in nfsd_cache_lookup()
468 rp->c_csum = csum; in nfsd_cache_lookup()
470 lru_put_end(b, rp); in nfsd_cache_lookup()
473 if (rp->c_type == RC_REPLBUFF) { in nfsd_cache_lookup()
474 drc_mem_usage -= rp->c_replvec.iov_len; in nfsd_cache_lookup()
475 kfree(rp->c_replvec.iov_base); in nfsd_cache_lookup()
476 rp->c_replvec.iov_base = NULL; in nfsd_cache_lookup()
478 rp->c_type = RC_NOCACHE; in nfsd_cache_lookup()
486 age = jiffies - rp->c_timestamp; in nfsd_cache_lookup()
487 lru_put_end(b, rp); in nfsd_cache_lookup()
491 if (rp->c_state == RC_INPROG || age < RC_DELAY) in nfsd_cache_lookup()
497 if (!test_bit(RQ_SECURE, &rqstp->rq_flags) && rp->c_secure) in nfsd_cache_lookup()
501 switch (rp->c_type) { in nfsd_cache_lookup()
505 svc_putu32(&rqstp->rq_res.head[0], rp->c_replstat); in nfsd_cache_lookup()
509 if (!nfsd_cache_append(rqstp, &rp->c_replvec)) in nfsd_cache_lookup()
514 printk(KERN_WARNING "nfsd: bad repcache type %d\n", rp->c_type); in nfsd_cache_lookup()
515 nfsd_reply_cache_free_locked(rp); in nfsd_cache_lookup()
540 struct svc_cacherep *rp = rqstp->rq_cacherep; in nfsd_cache_update() local
547 if (!rp) in nfsd_cache_update()
550 hash = nfsd_cache_hash(rp->c_xid); in nfsd_cache_update()
558 nfsd_reply_cache_free(b, rp); in nfsd_cache_update()
566 rp->c_replstat = *statp; in nfsd_cache_update()
569 cachv = &rp->c_replvec; in nfsd_cache_update()
573 nfsd_reply_cache_free(b, rp); in nfsd_cache_update()
580 nfsd_reply_cache_free(b, rp); in nfsd_cache_update()
585 lru_put_end(b, rp); in nfsd_cache_update()
586 rp->c_secure = test_bit(RQ_SECURE, &rqstp->rq_flags); in nfsd_cache_update()
587 rp->c_type = cachetype; in nfsd_cache_update()
588 rp->c_state = RC_DONE; in nfsd_cache_update()