aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-07-27 18:40:09 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-07-28 14:29:54 -0400
commitb101ebbc39f50f8af4657e517954ca874b13b364 (patch)
treea92e8df431a08450149b19c1db8365932e3ebc90 /fs/nfsd/nfs4state.c
parentbe98d1bbd1b872a10d64cdef0af10b9afcc48092 (diff)
nfsd41: minor set_forechannel_maxreqs cleanup
Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 69bd37e3fdcf..70cba3fbfa6d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -423,26 +423,25 @@ gen_sessionid(struct nfsd4_session *ses)
423 */ 423 */
424static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan) 424static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
425{ 425{
426 int status = 0, np = fchan->maxreqs * NFSD_PAGES_PER_SLOT; 426 int np;
427 427
428 if (fchan->maxreqs < 1) 428 if (fchan->maxreqs < 1)
429 return nfserr_inval; 429 return nfserr_inval;
430 else if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION) 430 else if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
431 fchan->maxreqs = NFSD_MAX_SLOTS_PER_SESSION; 431 fchan->maxreqs = NFSD_MAX_SLOTS_PER_SESSION;
432 432
433 np = fchan->maxreqs * NFSD_PAGES_PER_SLOT;
434
433 spin_lock(&nfsd_drc_lock); 435 spin_lock(&nfsd_drc_lock);
434 if (np + nfsd_drc_pages_used > nfsd_drc_max_pages) 436 if (np + nfsd_drc_pages_used > nfsd_drc_max_pages)
435 np = nfsd_drc_max_pages - nfsd_drc_pages_used; 437 np = nfsd_drc_max_pages - nfsd_drc_pages_used;
436 nfsd_drc_pages_used += np; 438 nfsd_drc_pages_used += np;
437 spin_unlock(&nfsd_drc_lock); 439 spin_unlock(&nfsd_drc_lock);
438 440
439 if (np <= 0) { 441 fchan->maxreqs = np / NFSD_PAGES_PER_SLOT;
440 status = nfserr_resource; 442 if (fchan->maxreqs == 0)
441 fchan->maxreqs = 0; 443 return nfserr_resource;
442 } else 444 return 0;
443 fchan->maxreqs = np / NFSD_PAGES_PER_SLOT;
444
445 return status;
446} 445}
447 446
448/* 447/*