From patchwork Fri Sep 11 10:54:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7159441 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B25E9F380 for ; Fri, 11 Sep 2015 10:55:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A22852085A for ; Fri, 11 Sep 2015 10:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C775920855 for ; Fri, 11 Sep 2015 10:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752830AbbIKKzJ (ORCPT ); Fri, 11 Sep 2015 06:55:09 -0400 Received: from mail-yk0-f172.google.com ([209.85.160.172]:32951 "EHLO mail-yk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752801AbbIKKzE (ORCPT ); Fri, 11 Sep 2015 06:55:04 -0400 Received: by ykei199 with SMTP id i199so86958991yke.0 for ; Fri, 11 Sep 2015 03:55:03 -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=bCTMF2QAS2avz1fzAxqTh/P5o/ilIL3JWU51pRujDew=; b=XmMLJzn9F/B4I0Hv8ID6BHPagMRQ45dv6iyZAc7S1aoqo4UR1EAINBkHUKcHGPk4Sq a10XoNw8L5pBN/64k0CiCj3KuS5sAX/uQPAtzyg/1SJmmUK7xNr6Hh6iKMfWyk4SwwTH lWAqHExSITIhdb5oHKf3P9O5OzBJK9RuVxg4cnVX4idLmYmQE8lSROBzmsRQJsMl2TOW EEidESq/DvPryuahJXPTT+FKduoMkpQ1b1WKXJup4zgFaA3dUOwE1Ao26oImRuYA9PIn 7FdksxCwevLGbO1bCOu7R8m3vN+rF6vGakAzb8ljTrDLN1aumWH/gr+U8jZjfKzXwoIY qhVw== X-Gm-Message-State: ALoCoQn5DMsuBkrGpEgVqvtG6UftNS4pWQQSY/vfHLzbkaTz5GU7vVEbrx02ZVC6bdmlMduy7hRT X-Received: by 10.129.146.198 with SMTP id j189mr40667215ywg.71.1441968903889; Fri, 11 Sep 2015 03:55:03 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1105:8e:3a60:77ff:fe93:a95d]) by smtp.googlemail.com with ESMTPSA id u8sm489915ywe.17.2015.09.11.03.55.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 03:55:03 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v4 11/16] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Fri, 11 Sep 2015 06:54:37 -0400 Message-Id: <1441968882-7851-12-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441968882-7851-1-git-send-email-jeff.layton@primarydata.com> References: <1441968882-7851-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 af942ff4546f..ca9dc84ca4b0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1034,9 +1034,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; @@ -1046,12 +1046,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); @@ -1059,7 +1059,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; }