NFSD: De-duplicate net_generic(nf->nf_net, nfsd_net_id)
authorChuck Lever <chuck.lever@oracle.com>
Tue, 28 Dec 2021 19:26:03 +0000 (14:26 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 8 Jan 2022 19:42:02 +0000 (14:42 -0500)
Since this pointer is used repeatedly, move it to a stack variable.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/vfs.c

index 2e473d2..c22511d 100644 (file)
@@ -1103,6 +1103,7 @@ __be32
 nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
                loff_t offset, unsigned long count, __be32 *verf)
 {
+       struct nfsd_net         *nn;
        struct nfsd_file        *nf;
        loff_t                  end = LLONG_MAX;
        __be32                  err = nfserr_inval;
@@ -1119,6 +1120,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
                        NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf);
        if (err)
                goto out;
+       nn = net_generic(nf->nf_net, nfsd_net_id);
        if (EX_ISSYNC(fhp->fh_export)) {
                errseq_t since = READ_ONCE(nf->nf_file->f_wb_err);
                int err2;
@@ -1126,8 +1128,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
                err2 = vfs_fsync_range(nf->nf_file, offset, end, 0);
                switch (err2) {
                case 0:
-                       nfsd_copy_boot_verifier(verf, net_generic(nf->nf_net,
-                                               nfsd_net_id));
+                       nfsd_copy_boot_verifier(verf, nn);
                        err2 = filemap_check_wb_err(nf->nf_file->f_mapping,
                                                    since);
                        break;
@@ -1135,13 +1136,11 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
                        err = nfserr_notsupp;
                        break;
                default:
-                       nfsd_reset_boot_verifier(net_generic(nf->nf_net,
-                                                nfsd_net_id));
+                       nfsd_reset_boot_verifier(nn);
                }
                err = nfserrno(err2);
        } else
-               nfsd_copy_boot_verifier(verf, net_generic(nf->nf_net,
-                                       nfsd_net_id));
+               nfsd_copy_boot_verifier(verf, nn);
 
        nfsd_file_put(nf);
 out: