Skip to content

Commit 803bc84

Browse files
Mike Snitzerchucklever
authored andcommitted
NFSD: pass nfsd_file to nfsd_iter_read()
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>
1 parent cc6c40e commit 803bc84

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

fs/nfsd/nfs4xdr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,7 +4472,7 @@ static __be32 nfsd4_encode_splice_read(
44724472

44734473
static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
44744474
struct nfsd4_read *read,
4475-
struct file *file, unsigned long maxcount)
4475+
unsigned long maxcount)
44764476
{
44774477
struct xdr_stream *xdr = resp->xdr;
44784478
unsigned int base = xdr->buf->page_len & ~PAGE_MASK;
@@ -4483,7 +4483,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
44834483
if (xdr_reserve_space_vec(xdr, maxcount) < 0)
44844484
return nfserr_resource;
44854485

4486-
nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file,
4486+
nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, read->rd_nf,
44874487
read->rd_offset, &maxcount, base,
44884488
&read->rd_eof);
44894489
read->rd_length = maxcount;
@@ -4530,7 +4530,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
45304530
if (file->f_op->splice_read && splice_ok)
45314531
nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
45324532
else
4533-
nfserr = nfsd4_encode_readv(resp, read, file, maxcount);
4533+
nfserr = nfsd4_encode_readv(resp, read, maxcount);
45344534
if (nfserr) {
45354535
xdr_truncate_encode(xdr, eof_offset);
45364536
return nfserr;
@@ -5426,7 +5426,7 @@ nfsd4_encode_read_plus_data(struct nfsd4_compoundres *resp,
54265426
if (file->f_op->splice_read && splice_ok)
54275427
nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
54285428
else
5429-
nfserr = nfsd4_encode_readv(resp, read, file, maxcount);
5429+
nfserr = nfsd4_encode_readv(resp, read, maxcount);
54305430
if (nfserr)
54315431
return nfserr;
54325432

fs/nfsd/vfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
10781078
* nfsd_iter_read - Perform a VFS read using an iterator
10791079
* @rqstp: RPC transaction context
10801080
* @fhp: file handle of file to be read
1081-
* @file: opened struct file of file to be read
1081+
* @nf: opened struct nfsd_file of file to be read
10821082
* @offset: starting byte offset
10831083
* @count: IN: requested number of bytes; OUT: number of bytes read
10841084
* @base: offset in first page of read buffer
@@ -1091,9 +1091,10 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
10911091
* returned.
10921092
*/
10931093
__be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
1094-
struct file *file, loff_t offset, unsigned long *count,
1094+
struct nfsd_file *nf, loff_t offset, unsigned long *count,
10951095
unsigned int base, u32 *eof)
10961096
{
1097+
struct file *file = nf->nf_file;
10971098
unsigned long v, total;
10981099
struct iov_iter iter;
10991100
struct kiocb kiocb;
@@ -1336,7 +1337,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
13361337
if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp))
13371338
err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof);
13381339
else
1339-
err = nfsd_iter_read(rqstp, fhp, file, offset, count, 0, eof);
1340+
err = nfsd_iter_read(rqstp, fhp, nf, offset, count, 0, eof);
13401341

13411342
nfsd_file_put(nf);
13421343
trace_nfsd_read_done(rqstp, fhp, offset, *count);

fs/nfsd/vfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
121121
unsigned long *count,
122122
u32 *eof);
123123
__be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
124-
struct file *file, loff_t offset,
124+
struct nfsd_file *nf, loff_t offset,
125125
unsigned long *count, unsigned int base,
126126
u32 *eof);
127127
bool nfsd_read_splice_ok(struct svc_rqst *rqstp);

0 commit comments

Comments
 (0)