nfsd41: minor set_forechannel_maxreqs cleanup
Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
This commit is contained in:
committed by
J. Bruce Fields
parent
be98d1bbd1
commit
b101ebbc39
@@ -423,26 +423,25 @@ gen_sessionid(struct nfsd4_session *ses)
|
|||||||
*/
|
*/
|
||||||
static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
|
static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
|
||||||
{
|
{
|
||||||
int status = 0, np = fchan->maxreqs * NFSD_PAGES_PER_SLOT;
|
int np;
|
||||||
|
|
||||||
if (fchan->maxreqs < 1)
|
if (fchan->maxreqs < 1)
|
||||||
return nfserr_inval;
|
return nfserr_inval;
|
||||||
else if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
|
else if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
|
||||||
fchan->maxreqs = NFSD_MAX_SLOTS_PER_SESSION;
|
fchan->maxreqs = NFSD_MAX_SLOTS_PER_SESSION;
|
||||||
|
|
||||||
|
np = fchan->maxreqs * NFSD_PAGES_PER_SLOT;
|
||||||
|
|
||||||
spin_lock(&nfsd_drc_lock);
|
spin_lock(&nfsd_drc_lock);
|
||||||
if (np + nfsd_drc_pages_used > nfsd_drc_max_pages)
|
if (np + nfsd_drc_pages_used > nfsd_drc_max_pages)
|
||||||
np = nfsd_drc_max_pages - nfsd_drc_pages_used;
|
np = nfsd_drc_max_pages - nfsd_drc_pages_used;
|
||||||
nfsd_drc_pages_used += np;
|
nfsd_drc_pages_used += np;
|
||||||
spin_unlock(&nfsd_drc_lock);
|
spin_unlock(&nfsd_drc_lock);
|
||||||
|
|
||||||
if (np <= 0) {
|
|
||||||
status = nfserr_resource;
|
|
||||||
fchan->maxreqs = 0;
|
|
||||||
} else
|
|
||||||
fchan->maxreqs = np / NFSD_PAGES_PER_SLOT;
|
fchan->maxreqs = np / NFSD_PAGES_PER_SLOT;
|
||||||
|
if (fchan->maxreqs == 0)
|
||||||
return status;
|
return nfserr_resource;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user