diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-03-11 23:39:13 +0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-31 01:31:57 +0400 |
commit | 4f0cefbf389c28b0a2be34960797adb0c84ee43d (patch) | |
tree | 8ef1923fa15d4e2372e73e48df203facc4085c7c /fs/nfsd/nfs4proc.c | |
parent | 8c7424cff6bd33459945646cfcbf6dc6c899ab24 (diff) | |
download | linux-4f0cefbf389c28b0a2be34960797adb0c84ee43d.tar.xz |
nfsd4: more precise nfsd4_max_reply
It will turn out to be useful to have a more accurate estimate of reply
size; so, piggyback on the existing op reply-size estimators.
Also move nfsd4_max_reply to nfs4proc.c to get easier access to struct
nfsd4_operation and friends. (Thanks to Christoph Hellwig for pointing
out that simplification.)
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 20aad5a3005f..59c319528cf9 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1854,6 +1854,18 @@ static struct nfsd4_operation nfsd4_ops[] = { }, }; +int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op) +{ + struct nfsd4_operation *opdesc; + nfsd4op_rsize estimator; + + if (op->opnum == OP_ILLEGAL) + return op_encode_hdr_size * sizeof(__be32); + opdesc = OPDESC(op); + estimator = opdesc->op_rsize_bop; + return estimator ? estimator(rqstp, op) : PAGE_SIZE; +} + void warn_on_nonidempotent_op(struct nfsd4_op *op) { if (OPDESC(op)->op_flags & OP_MODIFIES_SOMETHING) { |