11 #include <linux/slab.h>
22 #define CACHESIZE 1024
27 static int cache_disabled = 1;
39 static int nfsd_cache_append(
struct svc_rqst *rqstp,
struct kvec *vec);
62 INIT_HLIST_NODE(&rp->
c_hash);
85 kfree(rp->c_replvec.iov_base);
111 hlist_del_init(&rp->
c_hash);
112 hlist_add_head(&rp->
c_hash, cache_hash + request_hash(rp->
c_xid));
140 spin_lock(&cache_lock);
143 rh = &cache_hash[request_hash(xid)];
163 printk(
"nfsd: loop in repcache LRU list\n");
172 static int complaints;
175 if (++complaints > 5) {
195 kfree(rp->c_replvec.iov_base);
196 rp->c_replvec.iov_base =
NULL;
200 spin_unlock(&cache_lock);
225 svc_putu32(&rqstp->
rq_res.head[0], rp->c_replstat);
229 if (!nfsd_cache_append(rqstp, &rp->c_replvec))
271 if (!statp || len > (256 >> 2)) {
279 printk(
"nfsd: RC_REPLSTAT/reply len %d!\n",len);
280 rp->c_replstat = *statp;
283 cachv = &rp->c_replvec;
285 if (!cachv->iov_base) {
286 spin_lock(&cache_lock);
288 spin_unlock(&cache_lock);
291 cachv->iov_len = len << 2;
292 memcpy(cachv->iov_base, statp, len << 2);
295 spin_lock(&cache_lock);
301 spin_unlock(&cache_lock);