Return-Path: Received: from mail-yk0-f171.google.com ([209.85.160.171]:35826 "EHLO mail-yk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbbHTLRh (ORCPT ); Thu, 20 Aug 2015 07:17:37 -0400 Received: by ykbi184 with SMTP id i184so33654347ykb.2 for ; Thu, 20 Aug 2015 04:17:37 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@lst.de, kinglongmee@gmail.com Subject: [PATCH v3 11/20] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Thu, 20 Aug 2015 07:17:11 -0400 Message-Id: <1440069440-27454-12-git-send-email-jeff.layton@primarydata.com> In-Reply-To: <1440069440-27454-1-git-send-email-jeff.layton@primarydata.com> References: <1440069440-27454-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: Use cached filps if possible instead of opening a new one every time. Signed-off-by: Jeff Layton --- fs/nfsd/vfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 81600bd06fef..6cfd96adcc71 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1028,9 +1028,9 @@ __be32 nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, unsigned long count) { - struct file *file; - loff_t end = LLONG_MAX; - __be32 err = nfserr_inval; + struct nfsd_file *nf; + loff_t end = LLONG_MAX; + __be32 err = nfserr_inval; if (offset < 0) goto out; @@ -1040,12 +1040,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, goto out; } - err = nfsd_open(rqstp, fhp, S_IFREG, - NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file); + err = nfsd_file_acquire(rqstp, fhp, + NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf); if (err) goto out; if (EX_ISSYNC(fhp->fh_export)) { - int err2 = vfs_fsync_range(file, offset, end, 0); + int err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); if (err2 != -EINVAL) err = nfserrno(err2); @@ -1053,7 +1053,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; } -- 2.4.3