From patchwork Mon Oct 5 11:02:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7326411 Return-Path: X-Original-To: patchwork-linux-fsdevel@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 3060DBEEA4 for ; Mon, 5 Oct 2015 11:03:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CF67206E9 for ; Mon, 5 Oct 2015 11:03:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79DB4206F8 for ; Mon, 5 Oct 2015 11:03:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751795AbbJELDH (ORCPT ); Mon, 5 Oct 2015 07:03:07 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:33026 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbbJELDC (ORCPT ); Mon, 5 Oct 2015 07:03:02 -0400 Received: by qgev79 with SMTP id v79so145483350qge.0 for ; Mon, 05 Oct 2015 04:03:02 -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=K7eZ4q+0NlEXYBs4RHljpq8/b9u/GUNyvP71NodShiw=; b=SWNBtJgSAGAzfx+A/9qfyc/DfMBXLZ8FGPp8cTEJ/UTNAjNis/iu9kTzaMmgis5Ok7 cq9p7xfNhw50zaagt5CqW9lw1WCtfhe9syoF95zCkLiDf6jw/lWbyIPNj+C6euRJrSCT 1KDKHuSrMWDL4Af9mA2h3PGI4kq+enbDW6whxc2w4bOqefmziP64PTcdcqz+tXUmclHA JPjdxldRKylVwpmPQ2Dc9DzE8PVVC1Lz6JXHWTmP4m4GU5gVA/MdNC9T2rSdA1vIhpM5 BmMhZx34V1HCNsR03OaZ/HSnBa0bZigHMj0VAkP5oZmvdL2Kij7Ot70OiFjTvEFaeAFv kL6Q== X-Gm-Message-State: ALoCoQnOiajZ2cRWuxaTPajfQH99AkuS8FaGKjGs13SHxPcFbTOPQRGjAQvhhz5zHQZ1d4z2WaBg X-Received: by 10.141.23.19 with SMTP id z19mr40970835qhd.39.1444042982250; Mon, 05 Oct 2015 04:03:02 -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.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2015 04:03:01 -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 14/20] nfsd: hook up nfsd_read to the nfsd_file cache Date: Mon, 5 Oct 2015 07:02:36 -0400 Message-Id: <1444042962-6947-15-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 Signed-off-by: Jeff Layton --- fs/nfsd/vfs.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index cb1ab146246b..050db266ef80 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1008,20 +1008,15 @@ out_nfserr: __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, struct kvec *vec, int vlen, unsigned long *count) { - struct file *file; - struct raparms *ra; - __be32 err; - - err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); - if (err) - return err; - - ra = nfsd_init_raparms(file); - err = nfsd_vfs_read(rqstp, file, offset, vec, vlen, count); - if (ra) - nfsd_put_raparams(file, ra); - fput(file); + __be32 err; + struct nfsd_file *nf; + err = nfsd_file_acquire(rqstp, fhp, NFSD_MAY_READ, &nf); + if (err == nfs_ok) { + err = nfsd_vfs_read(rqstp, nf->nf_file, offset, vec, vlen, + count); + nfsd_file_put(nf); + } return err; }