diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-09-25 16:28:04 +0300 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-10-16 19:44:29 +0300 |
commit | cc313f80d0591aa5076761ce1854e3ef144084ec (patch) | |
tree | 11ebe22d55173cc2360ae8fd599a45021fd25f44 /fs/nfsd/nfs4xdr.c | |
parent | 69f5f0194a7f0f6bb22676a75dc81357a6d22698 (diff) | |
download | linux-cc313f80d0591aa5076761ce1854e3ef144084ec.tar.xz |
NFSD: Clean up nfsd4_encode_layoutcommit()
Adopt the use of conventional XDR utility functions. Restructure
the encoder to better align with the XDR definition of the result.
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.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 8839788b268d..0f8f1f7d5840 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4914,20 +4914,15 @@ nfsd4_encode_layoutcommit(struct nfsd4_compoundres *resp, __be32 nfserr, { struct nfsd4_layoutcommit *lcp = &u->layoutcommit; struct xdr_stream *xdr = resp->xdr; - __be32 *p; - - p = xdr_reserve_space(xdr, 4); - if (!p) - return nfserr_resource; - *p++ = cpu_to_be32(lcp->lc_size_chg); - if (lcp->lc_size_chg) { - p = xdr_reserve_space(xdr, 8); - if (!p) - return nfserr_resource; - p = xdr_encode_hyper(p, lcp->lc_newsize); - } - return 0; + /* ns_sizechanged */ + nfserr = nfsd4_encode_bool(xdr, lcp->lc_size_chg); + if (nfserr != nfs_ok) + return nfserr; + if (lcp->lc_size_chg) + /* ns_size */ + return nfsd4_encode_length4(xdr, lcp->lc_newsize); + return nfs_ok; } static __be32 |