summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2023-09-18 10:00:50 -0400
committerChuck Lever <chuck.lever@oracle.com>2023-10-16 12:44:23 -0400
commiteed4d1adbbd268be2a5e75be770b58097d668982 (patch)
treeda071da3fe919677b66e2459cb824e616a3efb11 /fs/nfsd
parent6d37ac3adb310dabe78e5ff0289f4bfeceda2114 (diff)
downloadlinux-stable-eed4d1adbbd268be2a5e75be770b58097d668982.tar.gz
linux-stable-eed4d1adbbd268be2a5e75be770b58097d668982.tar.bz2
linux-stable-eed4d1adbbd268be2a5e75be770b58097d668982.zip
NFSD: Add nfsd4_encode_fattr4_time_access()
Refactor the encoder for FATTR4_TIME_ACCESS 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>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4xdr.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b8938521528f..a973cf186e58 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2536,16 +2536,16 @@ static __be32 nfsd4_encode_nfs_fh4(struct xdr_stream *xdr,
return nfsd4_encode_opaque(xdr, fh_handle->fh_raw, fh_handle->fh_size);
}
+/* This is a frequently-encoded type; open-coded for speed */
static __be32 nfsd4_encode_nfstime4(struct xdr_stream *xdr,
- struct timespec64 *tv)
+ const struct timespec64 *tv)
{
__be32 *p;
p = xdr_reserve_space(xdr, XDR_UNIT * 3);
if (!p)
return nfserr_resource;
-
- p = xdr_encode_hyper(p, (s64)tv->tv_sec);
+ p = xdr_encode_hyper(p, tv->tv_sec);
*p = cpu_to_be32(tv->tv_nsec);
return nfs_ok;
}
@@ -3255,6 +3255,12 @@ static __be32 nfsd4_encode_fattr4_space_used(struct xdr_stream *xdr,
return nfsd4_encode_uint64_t(xdr, (u64)args->stat.blocks << 9);
}
+static __be32 nfsd4_encode_fattr4_time_access(struct xdr_stream *xdr,
+ const struct nfsd4_fattr_args *args)
+{
+ return nfsd4_encode_nfstime4(xdr, &args->stat.atime);
+}
+
/*
* Note: @fhp can be NULL; in this case, we might have to compose the filehandle
* ourselves.
@@ -3583,7 +3589,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
goto out;
}
if (bmval1 & FATTR4_WORD1_TIME_ACCESS) {
- status = nfsd4_encode_nfstime4(xdr, &args.stat.atime);
+ status = nfsd4_encode_fattr4_time_access(xdr, &args);
if (status)
goto out;
}