From patchwork Mon Oct 5 11:02: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: 7326441 Return-Path: X-Original-To: patchwork-linux-fsdevel@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 EED529F1D5 for ; Mon, 5 Oct 2015 11:03:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AAD02078E for ; Mon, 5 Oct 2015 11:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F270206E9 for ; Mon, 5 Oct 2015 11:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbbJELDG (ORCPT ); Mon, 5 Oct 2015 07:03:06 -0400 Received: from mail-qg0-f52.google.com ([209.85.192.52]:35722 "EHLO mail-qg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751540AbbJELDD (ORCPT ); Mon, 5 Oct 2015 07:03:03 -0400 Received: by qgt47 with SMTP id 47so145708422qgt.2 for ; Mon, 05 Oct 2015 04:03: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=Qp84VL1vGshhp7j6FgxdL1dD8I0/IHA6l/no4dT/7d8=; b=CcRorLEGCB0SzgonCrW2v/VD0/ObCrao7fNeLPa5za6OHT/Y8Kz51dFmkowjFGyc6O rhq1g2cXvQXDy7ToxDM8ceN6Hw1Tdlqquvm+ZyuJpVVzmKOLlZAszqOHN1QJLggoOu17 Oa3zmEaKTcLz3qfIdeIBRqnbZ8Fs1DTfmbg7eO8lHIP+JjceAFi+aodiVoN6Mar5B/Tf jKRE5WwZdSqG/vTTf2EJuFYK4T1lxKb9FcJvju9qkYiB3Wq0cD3TRvBn1vYuM+bgwH3i jecj699KM+UFRvoikanhoywavv7CjSV1fsQ3dkHuT7vLTQFi0Me4rmQlj7KYcd+59roH vp6Q== X-Gm-Message-State: ALoCoQnTyulDRNaHl2tbpULoxN+ctOukxnJXYk1qghK7TpzJw0yafX684l+8GQ/Yb6UowYGhhVof X-Received: by 10.140.33.201 with SMTP id j67mr38215638qgj.49.1444042983114; Mon, 05 Oct 2015 04:03:03 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1125:6079::d5a]) by smtp.googlemail.com with ESMTPSA id p39sm4977719qkp.47.2015.10.05.04.03.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2015 04:03:02 -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, Al Viro Subject: [PATCH v5 15/20] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Mon, 5 Oct 2015 07:02:37 -0400 Message-Id: <1444042962-6947-16-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444042962-6947-1-git-send-email-jeff.layton@primarydata.com> References: <1444042962-6947-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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 050db266ef80..571f1000e670 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1055,9 +1055,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; @@ -1067,12 +1067,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); @@ -1080,7 +1080,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; }