NFSD: Update NFSv3 READDIR entry encoders to use struct xdr_stream
authorChuck Lever <chuck.lever@oracle.com>
Thu, 22 Oct 2020 23:46:58 +0000 (19:46 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 22 Mar 2021 14:18:56 +0000 (10:18 -0400)
commit7f87fc2d34d475225e78b7f5c4eabb121f4282b2
treea21c1e2521cc016660e764475085ea9ff7acb7cc
parente4ccfe3014de435984939a3d84b7f241d3b57b0d
NFSD: Update NFSv3 READDIR entry encoders to use struct xdr_stream

The benefit of the xdr_stream helpers is that they transparently
handle encoding an XDR data item that crosses page boundaries.
Most of the open-coded logic to do that here can be eliminated.

A sub-buffer and sub-stream are set up as a sink buffer for the
directory entry encoder. As an entry is encoded, it is added to
the end of the content in this buffer/stream. The total length of
the directory list is tracked in the buffer's @len field.

When it comes time to encode the Reply, the sub-buffer is merged
into rq_res's page array at the correct place using
xdr_write_pages().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3xdr.c
fs/nfsd/xdr3.h