summaryrefslogtreecommitdiff
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2022-07-22 23:09:16 +0300
committerChuck Lever <chuck.lever@oracle.com>2022-07-30 03:16:57 +0300
commit5e64d85c7d0c59cfcd61d899720b8ccfe895d743 (patch)
tree0ef83e09842d42807aa15b60f82b51e21f2eb986 /fs/nfsd/nfs4xdr.c
parent071ae99feadfc55979f89287d6ad2c6a315cb46d (diff)
downloadlinux-5e64d85c7d0c59cfcd61d899720b8ccfe895d743.tar.xz
NFSD: Use xdr_pad_size()
Clean up: Use a helper instead of open-coding the calculation of the XDR pad size. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 32f4f48458e6..71bac0039c42 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3940,9 +3940,8 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
{
struct xdr_stream *xdr = resp->xdr;
unsigned int starting_len = xdr->buf->len;
+ __be32 zero = xdr_zero;
__be32 nfserr;
- __be32 tmp;
- int pad;
read->rd_vlen = xdr_reserve_space_vec(xdr, resp->rqstp->rq_vec, maxcount);
if (read->rd_vlen < 0)
@@ -3958,11 +3957,9 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
return nfserr_io;
xdr_truncate_encode(xdr, starting_len + xdr_align_size(maxcount));
- tmp = xdr_zero;
- pad = (maxcount&3) ? 4 - (maxcount&3) : 0;
- write_bytes_to_xdr_buf(xdr->buf, starting_len + maxcount, &tmp, pad);
- return 0;
-
+ write_bytes_to_xdr_buf(xdr->buf, starting_len + maxcount, &zero,
+ xdr_pad_size(maxcount));
+ return nfs_ok;
}
static __be32