aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandros Batsakis <Alexandros.Batsakis@netapp.com>2009-06-15 21:19:13 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-06-16 13:13:45 -0400
commit6c18ba9f5e506b8115b89b1aa7bdc25178f40b0a (patch)
tree12f046162b585649490be390695302bfdce11630
parentb9081d90f5b989cd927052084b16b4f950c8c8d7 (diff)
nfsd41: move channel attributes from nfsd4_session to a nfsd4_channel_attr struct
the change is valid for both the forechannel and the backchannel (currently dummy) Signed-off-by: Alexandros Batsakis <Alexandros.Batsakis@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/nfs4state.c28
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--include/linux/nfsd/state.h18
-rw-r--r--include/linux/nfsd/xdr4.h11
4 files changed, 29 insertions, 30 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 89d9ac55c034..d5caf2a709d2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -444,8 +444,8 @@ static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
444 * fchan holds the client values on input, and the server values on output 444 * fchan holds the client values on input, and the server values on output
445 */ 445 */
446static int init_forechannel_attrs(struct svc_rqst *rqstp, 446static int init_forechannel_attrs(struct svc_rqst *rqstp,
447 struct nfsd4_session *session, 447 struct nfsd4_channel_attrs *session_fchan,
448 struct nfsd4_channel_attrs *fchan) 448 struct nfsd4_channel_attrs *fchan)
449{ 449{
450 int status = 0; 450 int status = 0;
451 __u32 maxcount = svc_max_payload(rqstp); 451 __u32 maxcount = svc_max_payload(rqstp);
@@ -455,21 +455,21 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
455 /* Use the client's max request and max response size if possible */ 455 /* Use the client's max request and max response size if possible */
456 if (fchan->maxreq_sz > maxcount) 456 if (fchan->maxreq_sz > maxcount)
457 fchan->maxreq_sz = maxcount; 457 fchan->maxreq_sz = maxcount;
458 session->se_fmaxreq_sz = fchan->maxreq_sz; 458 session_fchan->maxreq_sz = fchan->maxreq_sz;
459 459
460 if (fchan->maxresp_sz > maxcount) 460 if (fchan->maxresp_sz > maxcount)
461 fchan->maxresp_sz = maxcount; 461 fchan->maxresp_sz = maxcount;
462 session->se_fmaxresp_sz = fchan->maxresp_sz; 462 session_fchan->maxresp_sz = fchan->maxresp_sz;
463 463
464 /* Set the max response cached size our default which is 464 /* Set the max response cached size our default which is
465 * a multiple of PAGE_SIZE and small */ 465 * a multiple of PAGE_SIZE and small */
466 session->se_fmaxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE; 466 session_fchan->maxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE;
467 fchan->maxresp_cached = session->se_fmaxresp_cached; 467 fchan->maxresp_cached = session_fchan->maxresp_cached;
468 468
469 /* Use the client's maxops if possible */ 469 /* Use the client's maxops if possible */
470 if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND) 470 if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND)
471 fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND; 471 fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND;
472 session->se_fmaxops = fchan->maxops; 472 session_fchan->maxops = fchan->maxops;
473 473
474 /* try to use the client requested number of slots */ 474 /* try to use the client requested number of slots */
475 if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION) 475 if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
@@ -481,7 +481,7 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
481 */ 481 */
482 status = set_forechannel_maxreqs(fchan); 482 status = set_forechannel_maxreqs(fchan);
483 483
484 session->se_fnumslots = fchan->maxreqs; 484 session_fchan->maxreqs = fchan->maxreqs;
485 return status; 485 return status;
486} 486}
487 487
@@ -495,12 +495,14 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
495 memset(&tmp, 0, sizeof(tmp)); 495 memset(&tmp, 0, sizeof(tmp));
496 496
497 /* FIXME: For now, we just accept the client back channel attributes. */ 497 /* FIXME: For now, we just accept the client back channel attributes. */
498 status = init_forechannel_attrs(rqstp, &tmp, &cses->fore_channel); 498 tmp.se_bchannel = cses->back_channel;
499 status = init_forechannel_attrs(rqstp, &tmp.se_fchannel,
500 &cses->fore_channel);
499 if (status) 501 if (status)
500 goto out; 502 goto out;
501 503
502 /* allocate struct nfsd4_session and slot table in one piece */ 504 /* allocate struct nfsd4_session and slot table in one piece */
503 slotsize = tmp.se_fnumslots * sizeof(struct nfsd4_slot); 505 slotsize = tmp.se_fchannel.maxreqs * sizeof(struct nfsd4_slot);
504 new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL); 506 new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL);
505 if (!new) 507 if (!new)
506 goto out; 508 goto out;
@@ -574,7 +576,7 @@ free_session(struct kref *kref)
574 int i; 576 int i;
575 577
576 ses = container_of(kref, struct nfsd4_session, se_ref); 578 ses = container_of(kref, struct nfsd4_session, se_ref);
577 for (i = 0; i < ses->se_fnumslots; i++) { 579 for (i = 0; i < ses->se_fchannel.maxreqs; i++) {
578 struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry; 580 struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry;
579 nfsd4_release_respages(e->ce_respages, e->ce_resused); 581 nfsd4_release_respages(e->ce_respages, e->ce_resused);
580 } 582 }
@@ -1130,7 +1132,7 @@ nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
1130 * is sent (lease renewal). 1132 * is sent (lease renewal).
1131 */ 1133 */
1132 if (seq && nfsd4_not_cached(resp)) { 1134 if (seq && nfsd4_not_cached(resp)) {
1133 seq->maxslots = resp->cstate.session->se_fnumslots; 1135 seq->maxslots = resp->cstate.session->se_fchannel.maxreqs;
1134 return nfs_ok; 1136 return nfs_ok;
1135 } 1137 }
1136 1138
@@ -1473,7 +1475,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
1473 goto out; 1475 goto out;
1474 1476
1475 status = nfserr_badslot; 1477 status = nfserr_badslot;
1476 if (seq->slotid >= session->se_fnumslots) 1478 if (seq->slotid >= session->se_fchannel.maxreqs)
1477 goto out; 1479 goto out;
1478 1480
1479 slot = &session->se_slots[seq->slotid]; 1481 slot = &session->se_slots[seq->slotid];
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d07f704a2ac9..2dcc7feaa6ff 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3183,7 +3183,7 @@ static int nfsd4_check_drc_limit(struct nfsd4_compoundres *resp)
3183 dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__, 3183 dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__,
3184 length, xb->page_len, tlen, pad); 3184 length, xb->page_len, tlen, pad);
3185 3185
3186 if (length <= session->se_fmaxresp_cached) 3186 if (length <= session->se_fchannel.maxresp_cached)
3187 return status; 3187 return status;
3188 else 3188 else
3189 return nfserr_rep_too_big_to_cache; 3189 return nfserr_rep_too_big_to_cache;
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index c0c49215ddc5..105cc100de05 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -115,6 +115,17 @@ struct nfsd4_slot {
115 struct nfsd4_cache_entry sl_cache_entry; 115 struct nfsd4_cache_entry sl_cache_entry;
116}; 116};
117 117
118struct nfsd4_channel_attrs {
119 u32 headerpadsz;
120 u32 maxreq_sz;
121 u32 maxresp_sz;
122 u32 maxresp_cached;
123 u32 maxops;
124 u32 maxreqs;
125 u32 nr_rdma_attrs;
126 u32 rdma_attrs;
127};
128
118struct nfsd4_session { 129struct nfsd4_session {
119 struct kref se_ref; 130 struct kref se_ref;
120 struct list_head se_hash; /* hash by sessionid */ 131 struct list_head se_hash; /* hash by sessionid */
@@ -122,11 +133,8 @@ struct nfsd4_session {
122 u32 se_flags; 133 u32 se_flags;
123 struct nfs4_client *se_client; /* for expire_client */ 134 struct nfs4_client *se_client; /* for expire_client */
124 struct nfs4_sessionid se_sessionid; 135 struct nfs4_sessionid se_sessionid;
125 u32 se_fmaxreq_sz; 136 struct nfsd4_channel_attrs se_fchannel;
126 u32 se_fmaxresp_sz; 137 struct nfsd4_channel_attrs se_bchannel;
127 u32 se_fmaxresp_cached;
128 u32 se_fmaxops;
129 u32 se_fnumslots;
130 struct nfsd4_slot se_slots[]; /* forward channel slots */ 138 struct nfsd4_slot se_slots[]; /* forward channel slots */
131}; 139};
132 140
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index d0f050f01eca..2bacf7535069 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -366,17 +366,6 @@ struct nfsd4_exchange_id {
366 int spa_how; 366 int spa_how;
367}; 367};
368 368
369struct nfsd4_channel_attrs {
370 u32 headerpadsz;
371 u32 maxreq_sz;
372 u32 maxresp_sz;
373 u32 maxresp_cached;
374 u32 maxops;
375 u32 maxreqs;
376 u32 nr_rdma_attrs;
377 u32 rdma_attrs;
378};
379
380struct nfsd4_create_session { 369struct nfsd4_create_session {
381 clientid_t clientid; 370 clientid_t clientid;
382 struct nfs4_sessionid sessionid; 371 struct nfs4_sessionid sessionid;