From patchwork Wed Aug 5 21:13:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 6953091 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28464C05AD for ; Wed, 5 Aug 2015 21:13:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54038204FF for ; Wed, 5 Aug 2015 21:13:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FB35204AB for ; Wed, 5 Aug 2015 21:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752637AbbHEVNw (ORCPT ); Wed, 5 Aug 2015 17:13:52 -0400 Received: from mail-yk0-f180.google.com ([209.85.160.180]:36587 "EHLO mail-yk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752472AbbHEVNv (ORCPT ); Wed, 5 Aug 2015 17:13:51 -0400 Received: by ykeo23 with SMTP id o23so46445421yke.3 for ; Wed, 05 Aug 2015 14:13:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jXq/Xw1RW8bhWls5qN8M4Ciwrmw4blSFxfXNNuOsOJ0=; b=l7qgZNfr0oWM8tmMuljH5Zfp/Lzn1z6oxuTA+v0qbjKrM6SxjjdQCn4Eu5mKLyX5RM 8PjNrFeENkJNh4a0XBnneveFFaiP4m85lVIlirmd3z0M0l/ZQws7sqTBxANNOJOTjmS0 ksUvWD/CrUgXk+Xww/9lbvFJVU6oC0Ksnc60rb1ds6kLua9ECindi4PzfI2XFZdlu1nL aQkGy9ZErRhCKOYOTEnCU09Jl4ij8J0mNsjlnbjQGzATm/ObEc/0C40cg5yQawLC2gZ9 kJhjMTjx6aMZ6arSfeYu1Y4ZFNXj+AROF2MfYXEGVb7YVyGzZ2Dch6FC40IMEUv22PJ6 simQ== X-Gm-Message-State: ALoCoQm4HXl2UU/BwwmjgcnW2daeWIUvBhJMuoSmqjPdddq3SxPoYJjZr6GonsyWvRIXB8GIWdig X-Received: by 10.129.113.137 with SMTP id m131mr11950616ywc.12.1438809231301; Wed, 05 Aug 2015 14:13:51 -0700 (PDT) Received: from tlielax.poochiereds.net (cpe-45-37-211-243.nc.res.rr.com. [45.37.211.243]) by smtp.googlemail.com with ESMTPSA id p81sm3975306ywe.19.2015.08.05.14.13.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 14:13:50 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 11/18] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Wed, 5 Aug 2015 17:13:29 -0400 Message-Id: <1438809216-4846-12-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1438809216-4846-1-git-send-email-jeff.layton@primarydata.com> References: <1438264341-18048-1-git-send-email-jeff.layton@primarydata.com> <1438809216-4846-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 79a881589ca7..8308d786c1e2 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1026,9 +1026,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; @@ -1038,12 +1038,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); @@ -1051,7 +1051,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; }