summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-03-08 16:42:05 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-05-30 17:31:51 -0400
commit67492c990300912c717bc95e9f705feb63de2df9 (patch)
treeab63eda6f32dcb4e72b754b3085341ad243a906f /fs
parent4e21ac4b6f1d09c56f7d10916eaa738361214ab7 (diff)
downloadblackbird-op-linux-67492c990300912c717bc95e9f705feb63de2df9.tar.gz
blackbird-op-linux-67492c990300912c717bc95e9f705feb63de2df9.zip
nfsd4: nfsd4_check_resp_size needn't recalculate length
We're keeping the length updated as we go now, so there's no need for the extra calculation here. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8728715cd6e8..89c65a3e09e4 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3752,32 +3752,20 @@ static nfsd4_enc nfsd4_enc_ops[] = {
*/
__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 pad)
{
- struct xdr_buf *xb = &resp->rqstp->rq_res;
+ struct xdr_buf *buf = &resp->rqstp->rq_res;
struct nfsd4_session *session = NULL;
struct nfsd4_slot *slot = resp->cstate.slot;
- u32 length, tlen = 0;
if (!nfsd4_has_session(&resp->cstate))
return 0;
session = resp->cstate.session;
- if (xb->page_len == 0) {
- length = (char *)resp->xdr.p - (char *)xb->head[0].iov_base + pad;
- } else {
- if (xb->tail[0].iov_base && xb->tail[0].iov_len > 0)
- tlen = (char *)resp->xdr.p - (char *)xb->tail[0].iov_base;
-
- length = xb->head[0].iov_len + xb->page_len + tlen + pad;
- }
- dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__,
- length, xb->page_len, tlen, pad);
-
- if (length > session->se_fchannel.maxresp_sz)
+ if (buf->len + pad > session->se_fchannel.maxresp_sz)
return nfserr_rep_too_big;
if ((slot->sl_flags & NFSD4_SLOT_CACHETHIS) &&
- length > session->se_fchannel.maxresp_cached)
+ buf->len + pad > session->se_fchannel.maxresp_cached)
return nfserr_rep_too_big_to_cache;
return 0;
OpenPOWER on IntegriCloud