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: 7326471 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 66D90BF90C for ; Mon, 5 Oct 2015 11:03:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 957222078E for ; Mon, 5 Oct 2015 11:03:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE020206F8 for ; Mon, 5 Oct 2015 11:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbbJELDG (ORCPT ); Mon, 5 Oct 2015 07:03:06 -0400 Received: from mail-qg0-f52.google.com ([209.85.192.52]:34279 "EHLO mail-qg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbbJELDD (ORCPT ); Mon, 5 Oct 2015 07:03:03 -0400 Received: by qgez77 with SMTP id z77so146017050qge.1 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=ev1nuJ6qlfj6jRE89fLTFY0Ny/sy6NosFno7/pZr/uzlUzjhvLiiM4ezTqPpTevB0P wcCEGl2Rjo1ldTo2tezJAbhw9W4k0cRM4xt2wuAjkT311PGB9bqHI5CRAtb/afWc+zvg fnNTUSWV/bKSco1C7XsErA54YHzwe6Nqzp0Diq0i87Lqkkpb52GhMTeBKFd9pzW/H6QW W0PwSNRbd0QNFTtgLAcC8O94wwWQ+OdVbv5DUiEldh5huz9cuYOO/vMEJJmYxsBST7rw mdQ7TLToMyS2UXc7ZMtAhfa4WObE7dhkZlkDKcqPpbWBPFmAII1qzHSwTS/9JzC/PSs9 Mw6Q== X-Gm-Message-State: ALoCoQk4p4OwDPc1l9DcXxsNMOVETl0fBChxnSEjMmZgO3qawkU2OCfsGDmpFA679CJ9M5CP2oyr 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-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 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; }