NFSD: cleanup dead codes and values in nfsd_write
authorKinglong Mee <kinglongmee@gmail.com>
Sat, 31 Dec 2016 13:00:13 +0000 (21:00 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 31 Jan 2017 17:31:53 +0000 (12:31 -0500)
This is just cleanup, no change in functionality.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs3proc.c
fs/nfsd/nfsproc.c
fs/nfsd/vfs.c
fs/nfsd/vfs.h

index 69cd0f1e26ff8b501849703148145215639b4a77..045c9081eabeb0242a0f60d49ec9177dc9c0c6f4 100644 (file)
@@ -193,11 +193,9 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
 
        fh_copy(&resp->fh, &argp->fh);
        resp->committed = argp->stable;
-       nfserr = nfsd_write(rqstp, &resp->fh, NULL,
-                                  argp->offset,
-                                  rqstp->rq_vec, argp->vlen,
-                                  &cnt,
-                                  resp->committed);
+       nfserr = nfsd_write(rqstp, &resp->fh, argp->offset,
+                               rqstp->rq_vec, argp->vlen,
+                               &cnt, resp->committed);
        resp->count = cnt;
        RETURN_STATUS(nfserr);
 }
index f157c7eff82f5831485685899b55a12ed21a57ae..fa82b7707e8531f9b7e8065391c3f54387c2740d 100644 (file)
@@ -210,11 +210,8 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
                SVCFH_fmt(&argp->fh),
                argp->len, argp->offset);
 
-       nfserr = nfsd_write(rqstp, fh_copy(&resp->fh, &argp->fh), NULL,
-                                  argp->offset,
-                                  rqstp->rq_vec, argp->vlen,
-                                  &cnt,
-                                  NFS_DATA_SYNC);
+       nfserr = nfsd_write(rqstp, fh_copy(&resp->fh, &argp->fh), argp->offset,
+                               rqstp->rq_vec, argp->vlen, &cnt, NFS_DATA_SYNC);
        return nfsd_return_attrs(nfserr, resp);
 }
 
index 1bedb2bc907e5fad75dc3531b311e7ca58c72fcc..2dd633fdef352e43f4418b61e178176bf9df8e4a 100644 (file)
@@ -1011,35 +1011,22 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
  * N.B. After this call fhp needs an fh_put
  */
 __be32
-nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
-               loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt,
-               int stable)
+nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
+          struct kvec *vec, int vlen, unsigned long *cnt, int stable)
 {
-       __be32                  err = 0;
+       struct file *file = NULL;
+       __be32 err = 0;
 
        trace_write_start(rqstp, fhp, offset, vlen);
 
-       if (file) {
-               err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,
-                               NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE);
-               if (err)
-                       goto out;
-               trace_write_opened(rqstp, fhp, offset, vlen);
-               err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt,
-                               stable);
-               trace_write_io_done(rqstp, fhp, offset, vlen);
-       } else {
-               err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file);
-               if (err)
-                       goto out;
+       err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file);
+       if (err)
+               goto out;
 
-               trace_write_opened(rqstp, fhp, offset, vlen);
-               if (cnt)
-                       err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen,
-                                            cnt, stable);
-               trace_write_io_done(rqstp, fhp, offset, vlen);
-               fput(file);
-       }
+       trace_write_opened(rqstp, fhp, offset, vlen);
+       err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, stable);
+       trace_write_io_done(rqstp, fhp, offset, vlen);
+       fput(file);
 out:
        trace_write_done(rqstp, fhp, offset, vlen);
        return err;
index 8458d8c08b18bb69598986b2b12cc6cf37bdd3c4..db98c48c735aaae5a914a6e2073391ceab436a2f 100644 (file)
@@ -83,8 +83,8 @@ __be32                nfsd_readv(struct file *, loff_t, struct kvec *, int,
                                unsigned long *);
 __be32                 nfsd_read(struct svc_rqst *, struct svc_fh *,
                                loff_t, struct kvec *, int, unsigned long *);
-__be32                 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
-                               loff_t, struct kvec *,int, unsigned long *, int);
+__be32                 nfsd_write(struct svc_rqst *, struct svc_fh *, loff_t,
+                               struct kvec *, int, unsigned long *, int);
 __be32         nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                struct file *file, loff_t offset,
                                struct kvec *vec, int vlen, unsigned long *cnt,