Skip to content

Commit

Permalink
NFSD: Add nfsd4_encode_fattr4_layout_blksize()
Browse files Browse the repository at this point in the history
Refactor the encoder for FATTR4_LAYOUT_BLKSIZE into a helper. In a
subsequent patch, this helper will be called from a bitmask loop.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Chuck Lever committed Oct 16, 2023
1 parent 4c15878 commit 4c58473
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3312,6 +3312,12 @@ static __be32 nfsd4_encode_fattr4_layout_types(struct xdr_stream *xdr,
return nfs_ok;
}

static __be32 nfsd4_encode_fattr4_layout_blksize(struct xdr_stream *xdr,
const struct nfsd4_fattr_args *args)
{
return nfsd4_encode_uint32_t(xdr, args->stat.blksize);
}

#endif

/*
Expand Down Expand Up @@ -3686,10 +3692,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
}

if (bmval2 & FATTR4_WORD2_LAYOUT_BLKSIZE) {
p = xdr_reserve_space(xdr, 4);
if (!p)
goto out_resource;
*p++ = cpu_to_be32(args.stat.blksize);
status = nfsd4_encode_fattr4_layout_blksize(xdr, &args);
if (status != nfs_ok)
goto out;
}
#endif /* CONFIG_NFSD_PNFS */
if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
Expand Down

0 comments on commit 4c58473

Please sign in to comment.