From patchwork Thu Aug 20 11:17:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7043691 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 94A479F695 for ; Thu, 20 Aug 2015 11:17:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4747205C2 for ; Thu, 20 Aug 2015 11:17:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C670E205CD for ; Thu, 20 Aug 2015 11:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbbHTLRj (ORCPT ); Thu, 20 Aug 2015 07:17:39 -0400 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) 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=8Q9/3pyZs792MFqrm8riYqy6v9Jdoq9MHm5/Uwc6UqM=; b=CYGZ2SAKR4BHArJzMtfFXzv3EnRqIy4dN35X9idrR6dKJACaUR/uEKiY/x3wFpRwDp CL/oxUAHlshQ+a6SwXa/XylSgrFct4K0QzIazGZjxyXp1/KRqHRPf7NfRrEF2RTwtQkD 9Nz7Wn84sk2o6ss8+M45LgdRy1mkOauM3vx2J6E7zlvt9nsUo4/VNl8HvRLqHhAOatRG DrH5bjUvyBK2U4epT6fudwaPVLLDXQKWd9f+tJntDPIJICWD6lqg+WnC7woPAuw6yhRV MnYqDouF/pBdXDkjel8JtYgLLdskxwIlP3V6yPTqwCrB9arSBLkvAJnT5htLWB+PmzCv k7BQ== X-Gm-Message-State: ALoCoQnQHW998NFVhHywxLhyuEvDRDSFJmSl9RBcaVOW3Q3R6YOfLQWfYKYYycc/e87ut8MGbifh X-Received: by 10.170.80.86 with SMTP id w83mr2495378ykw.46.1440069457258; Thu, 20 Aug 2015 04:17:37 -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 k66sm3637319ywe.0.2015.08.20.04.17.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2015 04:17:36 -0700 (PDT) From: Jeff Layton X-Google-Original-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> X-Mailer: git-send-email 2.4.3 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 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 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 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; }