aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-07-30 11:33:32 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-07-30 12:54:54 -0400
commit039a87ca536a85bc169ce092e44bd57adfa1f563 (patch)
tree015ddd79fb489241b0171ce3c863353ae6c03522 /fs
parent69049961014992f50b10d6c3cd3cd172d4aae5ac (diff)
nfsd: minor nfsd read api cleanup
Christoph points that the NFSv2/v3 callers know which case they want here, so we may as well just call the file=NULL case directly instead of making this conditional. Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--fs/nfsd/nfsproc.c2
-rw-r--r--fs/nfsd/vfs.c19
-rw-r--r--fs/nfsd/vfs.h4
5 files changed, 16 insertions, 13 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 9ae93317abe4..5b7e3021e06b 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -168,7 +168,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
168 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4); 168 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
169 169
170 fh_copy(&resp->fh, &argp->fh); 170 fh_copy(&resp->fh, &argp->fh);
171 nfserr = nfsd_read(rqstp, &resp->fh, NULL, 171 nfserr = nfsd_read(rqstp, &resp->fh,
172 argp->offset, 172 argp->offset,
173 rqstp->rq_vec, argp->vlen, 173 rqstp->rq_vec, argp->vlen,
174 &resp->count); 174 &resp->count);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 835924f5ca54..f8931acb05f3 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2630,7 +2630,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2630 } 2630 }
2631 read->rd_vlen = v; 2631 read->rd_vlen = v;
2632 2632
2633 nfserr = nfsd_read(read->rd_rqstp, read->rd_fhp, read->rd_filp, 2633 nfserr = nfsd_read_file(read->rd_rqstp, read->rd_fhp, read->rd_filp,
2634 read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen, 2634 read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen,
2635 &maxcount); 2635 &maxcount);
2636 2636
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 1edb78b96c5f..08e17264784b 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -144,7 +144,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
144 svc_reserve_auth(rqstp, (19<<2) + argp->count + 4); 144 svc_reserve_auth(rqstp, (19<<2) + argp->count + 4);
145 145
146 resp->count = argp->count; 146 resp->count = argp->count;
147 nfserr = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh), NULL, 147 nfserr = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh),
148 argp->offset, 148 argp->offset,
149 rqstp->rq_vec, argp->vlen, 149 rqstp->rq_vec, argp->vlen,
150 &resp->count); 150 &resp->count);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 3458a8f596f1..1709138affb1 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1065,7 +1065,12 @@ out:
1065 return err; 1065 return err;
1066} 1066}
1067 1067
1068static __be32 nfsd_open_read(struct svc_rqst *rqstp, struct svc_fh *fhp, 1068/*
1069 * Read data from a file. count must contain the requested read count
1070 * on entry. On return, *count contains the number of bytes actually read.
1071 * N.B. After this call fhp needs an fh_put
1072 */
1073__be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
1069 loff_t offset, struct kvec *vec, int vlen, unsigned long *count) 1074 loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
1070{ 1075{
1071 struct file *file; 1076 struct file *file;
@@ -1101,13 +1106,9 @@ static __be32 nfsd_open_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
1101 return err; 1106 return err;
1102} 1107}
1103 1108
1104/* 1109/* As above, but use the provided file descriptor. */
1105 * Read data from a file. count must contain the requested read count
1106 * on entry. On return, *count contains the number of bytes actually read.
1107 * N.B. After this call fhp needs an fh_put
1108 */
1109__be32 1110__be32
1110nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 1111nfsd_read_file(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1111 loff_t offset, struct kvec *vec, int vlen, 1112 loff_t offset, struct kvec *vec, int vlen,
1112 unsigned long *count) 1113 unsigned long *count)
1113{ 1114{
@@ -1119,8 +1120,8 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1119 if (err) 1120 if (err)
1120 goto out; 1121 goto out;
1121 err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count); 1122 err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count);
1122 } else 1123 } else /* Note file may still be NULL in NFSv4 special stateid case: */
1123 err = nfsd_open_read(rqstp, fhp, offset, vec, vlen, count); 1124 err = nfsd_read(rqstp, fhp, offset, vec, vlen, count);
1124out: 1125out:
1125 return err; 1126 return err;
1126} 1127}
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index 217a62c2a357..9a370a5e36b7 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -64,7 +64,9 @@ __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
64__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, 64__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int,
65 int, struct file **); 65 int, struct file **);
66void nfsd_close(struct file *); 66void nfsd_close(struct file *);
67__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 67__be32 nfsd_read(struct svc_rqst *, struct svc_fh *,
68 loff_t, struct kvec *, int, unsigned long *);
69__be32 nfsd_read_file(struct svc_rqst *, struct svc_fh *, struct file *,
68 loff_t, struct kvec *, int, unsigned long *); 70 loff_t, struct kvec *, int, unsigned long *);
69__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 71__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
70 loff_t, struct kvec *,int, unsigned long *, int *); 72 loff_t, struct kvec *,int, unsigned long *, int *);