Commit 6c18ba9f5e506b8115b89b1aa7bdc25178f40b0a
Committed by
J. Bruce Fields
1 parent
b9081d90f5
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>
Showing 4 changed files with 29 additions and 30 deletions Side-by-side Diff
fs/nfsd/nfs4state.c
... | ... | @@ -444,8 +444,8 @@ |
444 | 444 | * fchan holds the client values on input, and the server values on output |
445 | 445 | */ |
446 | 446 | static int init_forechannel_attrs(struct svc_rqst *rqstp, |
447 | - struct nfsd4_session *session, | |
448 | - struct nfsd4_channel_attrs *fchan) | |
447 | + struct nfsd4_channel_attrs *session_fchan, | |
448 | + struct nfsd4_channel_attrs *fchan) | |
449 | 449 | { |
450 | 450 | int status = 0; |
451 | 451 | __u32 maxcount = svc_max_payload(rqstp); |
452 | 452 | |
453 | 453 | |
454 | 454 | |
... | ... | @@ -455,21 +455,21 @@ |
455 | 455 | /* Use the client's max request and max response size if possible */ |
456 | 456 | if (fchan->maxreq_sz > maxcount) |
457 | 457 | fchan->maxreq_sz = maxcount; |
458 | - session->se_fmaxreq_sz = fchan->maxreq_sz; | |
458 | + session_fchan->maxreq_sz = fchan->maxreq_sz; | |
459 | 459 | |
460 | 460 | if (fchan->maxresp_sz > maxcount) |
461 | 461 | fchan->maxresp_sz = maxcount; |
462 | - session->se_fmaxresp_sz = fchan->maxresp_sz; | |
462 | + session_fchan->maxresp_sz = fchan->maxresp_sz; | |
463 | 463 | |
464 | 464 | /* Set the max response cached size our default which is |
465 | 465 | * a multiple of PAGE_SIZE and small */ |
466 | - session->se_fmaxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE; | |
467 | - fchan->maxresp_cached = session->se_fmaxresp_cached; | |
466 | + session_fchan->maxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE; | |
467 | + fchan->maxresp_cached = session_fchan->maxresp_cached; | |
468 | 468 | |
469 | 469 | /* Use the client's maxops if possible */ |
470 | 470 | if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND) |
471 | 471 | fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND; |
472 | - session->se_fmaxops = fchan->maxops; | |
472 | + session_fchan->maxops = fchan->maxops; | |
473 | 473 | |
474 | 474 | /* try to use the client requested number of slots */ |
475 | 475 | if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION) |
... | ... | @@ -481,7 +481,7 @@ |
481 | 481 | */ |
482 | 482 | status = set_forechannel_maxreqs(fchan); |
483 | 483 | |
484 | - session->se_fnumslots = fchan->maxreqs; | |
484 | + session_fchan->maxreqs = fchan->maxreqs; | |
485 | 485 | return status; |
486 | 486 | } |
487 | 487 | |
488 | 488 | |
... | ... | @@ -495,12 +495,14 @@ |
495 | 495 | memset(&tmp, 0, sizeof(tmp)); |
496 | 496 | |
497 | 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 | 501 | if (status) |
500 | 502 | goto out; |
501 | 503 | |
502 | 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 | 506 | new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL); |
505 | 507 | if (!new) |
506 | 508 | goto out; |
... | ... | @@ -574,7 +576,7 @@ |
574 | 576 | int i; |
575 | 577 | |
576 | 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 | 580 | struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry; |
579 | 581 | nfsd4_release_respages(e->ce_respages, e->ce_resused); |
580 | 582 | } |
... | ... | @@ -1130,7 +1132,7 @@ |
1130 | 1132 | * is sent (lease renewal). |
1131 | 1133 | */ |
1132 | 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 | 1136 | return nfs_ok; |
1135 | 1137 | } |
1136 | 1138 | |
... | ... | @@ -1473,7 +1475,7 @@ |
1473 | 1475 | goto out; |
1474 | 1476 | |
1475 | 1477 | status = nfserr_badslot; |
1476 | - if (seq->slotid >= session->se_fnumslots) | |
1478 | + if (seq->slotid >= session->se_fchannel.maxreqs) | |
1477 | 1479 | goto out; |
1478 | 1480 | |
1479 | 1481 | slot = &session->se_slots[seq->slotid]; |
fs/nfsd/nfs4xdr.c
... | ... | @@ -3183,7 +3183,7 @@ |
3183 | 3183 | dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__, |
3184 | 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 | 3187 | return status; |
3188 | 3188 | else |
3189 | 3189 | return nfserr_rep_too_big_to_cache; |
include/linux/nfsd/state.h
... | ... | @@ -115,6 +115,17 @@ |
115 | 115 | struct nfsd4_cache_entry sl_cache_entry; |
116 | 116 | }; |
117 | 117 | |
118 | +struct 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 | + | |
118 | 129 | struct nfsd4_session { |
119 | 130 | struct kref se_ref; |
120 | 131 | struct list_head se_hash; /* hash by sessionid */ |
... | ... | @@ -122,11 +133,8 @@ |
122 | 133 | u32 se_flags; |
123 | 134 | struct nfs4_client *se_client; /* for expire_client */ |
124 | 135 | struct nfs4_sessionid se_sessionid; |
125 | - u32 se_fmaxreq_sz; | |
126 | - u32 se_fmaxresp_sz; | |
127 | - u32 se_fmaxresp_cached; | |
128 | - u32 se_fmaxops; | |
129 | - u32 se_fnumslots; | |
136 | + struct nfsd4_channel_attrs se_fchannel; | |
137 | + struct nfsd4_channel_attrs se_bchannel; | |
130 | 138 | struct nfsd4_slot se_slots[]; /* forward channel slots */ |
131 | 139 | }; |
132 | 140 |
include/linux/nfsd/xdr4.h
... | ... | @@ -366,17 +366,6 @@ |
366 | 366 | int spa_how; |
367 | 367 | }; |
368 | 368 | |
369 | -struct 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 | - | |
380 | 369 | struct nfsd4_create_session { |
381 | 370 | clientid_t clientid; |
382 | 371 | struct nfs4_sessionid sessionid; |