]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFSD: pass nfsd_file to nfsd_iter_read()
authorMike Snitzer <snitzer@kernel.org>
Wed, 8 Oct 2025 13:52:28 +0000 (09:52 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 16 Nov 2025 23:20:11 +0000 (18:20 -0500)
Prepare for nfsd_iter_read() to use the DIO alignment stored in
nfsd_file by passing the nfsd_file to nfsd_iter_read() rather than
just the file which is associaed with the nfsd_file.

This means nfsd4_encode_readv() now also needs the nfsd_file rather
than the file.  Instead of changing the file arg to be the nfsd_file,
we discard the file arg as the nfsd_file (and indeed the file) is
already available via the "read" argument.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4xdr.c
fs/nfsd/vfs.c
fs/nfsd/vfs.h

index 67bb9c0b9fcb183332d09fd51cdc32a3d6cac6d4..494a703e05708b7965714f526f92aba1dfe9a1f7 100644 (file)
@@ -4472,7 +4472,7 @@ out_err:
 
 static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
                                 struct nfsd4_read *read,
-                                struct file *file, unsigned long maxcount)
+                                unsigned long maxcount)
 {
        struct xdr_stream *xdr = resp->xdr;
        unsigned int base = xdr->buf->page_len & ~PAGE_MASK;
@@ -4483,7 +4483,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
        if (xdr_reserve_space_vec(xdr, maxcount) < 0)
                return nfserr_resource;
 
-       nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file,
+       nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, read->rd_nf,
                                read->rd_offset, &maxcount, base,
                                &read->rd_eof);
        read->rd_length = maxcount;
@@ -4530,7 +4530,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
        if (file->f_op->splice_read && splice_ok)
                nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
        else
-               nfserr = nfsd4_encode_readv(resp, read, file, maxcount);
+               nfserr = nfsd4_encode_readv(resp, read, maxcount);
        if (nfserr) {
                xdr_truncate_encode(xdr, eof_offset);
                return nfserr;
@@ -5426,7 +5426,7 @@ nfsd4_encode_read_plus_data(struct nfsd4_compoundres *resp,
        if (file->f_op->splice_read && splice_ok)
                nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
        else
-               nfserr = nfsd4_encode_readv(resp, read, file, maxcount);
+               nfserr = nfsd4_encode_readv(resp, read, maxcount);
        if (nfserr)
                return nfserr;
 
index ea9c2de704294b5bd67bfb2d1801d2ad1e167736..406fe62de2193bfebdbfd4ce67357b5690299d48 100644 (file)
@@ -1078,7 +1078,7 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
  * nfsd_iter_read - Perform a VFS read using an iterator
  * @rqstp: RPC transaction context
  * @fhp: file handle of file to be read
- * @file: opened struct file of file to be read
+ * @nf: opened struct nfsd_file of file to be read
  * @offset: starting byte offset
  * @count: IN: requested number of bytes; OUT: number of bytes read
  * @base: offset in first page of read buffer
@@ -1091,9 +1091,10 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
  * returned.
  */
 __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
-                     struct file *file, loff_t offset, unsigned long *count,
+                     struct nfsd_file *nf, loff_t offset, unsigned long *count,
                      unsigned int base, u32 *eof)
 {
+       struct file *file = nf->nf_file;
        unsigned long v, total;
        struct iov_iter iter;
        struct kiocb kiocb;
@@ -1336,7 +1337,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
        if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp))
                err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof);
        else
-               err = nfsd_iter_read(rqstp, fhp, file, offset, count, 0, eof);
+               err = nfsd_iter_read(rqstp, fhp, nf, offset, count, 0, eof);
 
        nfsd_file_put(nf);
        trace_nfsd_read_done(rqstp, fhp, offset, *count);
index 0c0292611c6de3daf6f3ed51e2c61c0ad2751de4..fa46f8b5f132079e3a2c45e71ecf9cc43181f6b0 100644 (file)
@@ -121,7 +121,7 @@ __be32              nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                unsigned long *count,
                                u32 *eof);
 __be32         nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
-                               struct file *file, loff_t offset,
+                               struct nfsd_file *nf, loff_t offset,
                                unsigned long *count, unsigned int base,
                                u32 *eof);
 bool           nfsd_read_splice_ok(struct svc_rqst *rqstp);