aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3proc.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2020-11-10 09:57:14 -0500
committerChuck Lever <chuck.lever@oracle.com>2021-03-22 10:18:55 -0400
commita161e6c76aeba835e475a2f27dbbe5c37e565e94 (patch)
tree7cceba50ef0c175dca424b5429cf783d6eeec171 /fs/nfsd/nfs3proc.c
parentNFSD: Update the NFSv3 COMMIT3res encoder to use struct xdr_stream (diff)
downloadlinux-dev-a161e6c76aeba835e475a2f27dbbe5c37e565e94.tar.xz
linux-dev-a161e6c76aeba835e475a2f27dbbe5c37e565e94.zip
NFSD: Add a helper that encodes NFSv3 directory offset cookies
Refactor: De-duplicate identical code that handles encoding of directory offset cookies across page boundaries. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfs3proc.c')
-rw-r--r--fs/nfsd/nfs3proc.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 93d196752f87..90566cd01bdc 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -495,17 +495,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)
count += PAGE_SIZE;
}
resp->count = count >> 2;
- if (resp->offset) {
- if (unlikely(resp->offset1)) {
- /* we ended up with offset on a page boundary */
- *resp->offset = htonl(offset >> 32);
- *resp->offset1 = htonl(offset & 0xffffffff);
- resp->offset1 = NULL;
- } else {
- xdr_encode_hyper(resp->offset, offset);
- }
- resp->offset = NULL;
- }
+ nfs3svc_encode_cookie3(resp, offset);
return rpc_success;
}
@@ -560,17 +550,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
count += PAGE_SIZE;
}
resp->count = count >> 2;
- if (resp->offset) {
- if (unlikely(resp->offset1)) {
- /* we ended up with offset on a page boundary */
- *resp->offset = htonl(offset >> 32);
- *resp->offset1 = htonl(offset & 0xffffffff);
- resp->offset1 = NULL;
- } else {
- xdr_encode_hyper(resp->offset, offset);
- }
- resp->offset = NULL;
- }
+ nfs3svc_encode_cookie3(resp, offset);
out:
return rpc_success;