aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-08-28 08:45:04 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-01 22:24:06 -0400
commit557ce2646e775f6bda734dd92b10d4780874b9c7 (patch)
treea44a5e2f9d601a039f7ac9b30b5c4af95796fc23 /fs/nfsd/nfs4xdr.c
parentbdac86e2154cfe47552639113265d1fa27cfbe72 (diff)
nfsd41: replace page based DRC with buffer based DRC
Use NFSD_SLOT_CACHE_SIZE size buffers for sessions DRC instead of holding nfsd pages in cache. Connectathon testing has shown that 1024 bytes for encoded compound operation responses past the sequence operation is sufficient, 512 bytes is a little too small. Set NFSD_SLOT_CACHE_SIZE to 1024. Allocate memory for the session DRC in the CREATE_SESSION operation to guarantee that the memory resource is available for caching responses. Allocate each slot individually in preparation for slot table size negotiation. Remove struct nfsd4_cache_entry and helper functions for the old page-based DRC. The iov_len calculation in nfs4svc_encode_compoundres is now always correct. Replay is now done in nfsd4_sequence under the state lock, so the session ref count is only bumped on non-replay. Clean up the nfs4svc_encode_compoundres session logic. The nfsd4_compound_state statp pointer is also not used. Remove nfsd4_set_statp(). Move useful nfsd4_cache_entry fields into nfsd4_slot. Signed-off-by: Andy Adamson <andros@netapp.com Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 20c5e3db0660..00ed16a18497 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3057,6 +3057,7 @@ nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr,
3057 WRITE32(0); 3057 WRITE32(0);
3058 3058
3059 ADJUST_ARGS(); 3059 ADJUST_ARGS();
3060 resp->cstate.datap = p; /* DRC cache data pointer */
3060 return 0; 3061 return 0;
3061} 3062}
3062 3063
@@ -3159,7 +3160,7 @@ static int nfsd4_check_drc_limit(struct nfsd4_compoundres *resp)
3159 return status; 3160 return status;
3160 3161
3161 session = resp->cstate.session; 3162 session = resp->cstate.session;
3162 if (session == NULL || slot->sl_cache_entry.ce_cachethis == 0) 3163 if (session == NULL || slot->sl_cachethis == 0)
3163 return status; 3164 return status;
3164 3165
3165 if (resp->opcnt >= args->opcnt) 3166 if (resp->opcnt >= args->opcnt)
@@ -3284,6 +3285,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo
3284 /* 3285 /*
3285 * All that remains is to write the tag and operation count... 3286 * All that remains is to write the tag and operation count...
3286 */ 3287 */
3288 struct nfsd4_compound_state *cs = &resp->cstate;
3287 struct kvec *iov; 3289 struct kvec *iov;
3288 p = resp->tagp; 3290 p = resp->tagp;
3289 *p++ = htonl(resp->taglen); 3291 *p++ = htonl(resp->taglen);
@@ -3297,15 +3299,10 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo
3297 iov = &rqstp->rq_res.head[0]; 3299 iov = &rqstp->rq_res.head[0];
3298 iov->iov_len = ((char*)resp->p) - (char*)iov->iov_base; 3300 iov->iov_len = ((char*)resp->p) - (char*)iov->iov_base;
3299 BUG_ON(iov->iov_len > PAGE_SIZE); 3301 BUG_ON(iov->iov_len > PAGE_SIZE);
3300 if (nfsd4_has_session(&resp->cstate)) { 3302 if (nfsd4_has_session(cs) && cs->status != nfserr_replay_cache) {
3301 if (resp->cstate.status == nfserr_replay_cache && 3303 nfsd4_store_cache_entry(resp);
3302 !nfsd4_not_cached(resp)) { 3304 dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__);
3303 iov->iov_len = resp->cstate.iovlen; 3305 resp->cstate.slot->sl_inuse = false;
3304 } else {
3305 nfsd4_store_cache_entry(resp);
3306 dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__);
3307 resp->cstate.slot->sl_inuse = 0;
3308 }
3309 nfsd4_put_session(resp->cstate.session); 3306 nfsd4_put_session(resp->cstate.session);
3310 } 3307 }
3311 return 1; 3308 return 1;