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: 7326401 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 3BAFE9F1D5 for ; Mon, 5 Oct 2015 11:03:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 780F1206E9 for ; Mon, 5 Oct 2015 11:03:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F2A6206EB for ; Mon, 5 Oct 2015 11:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbbJELDI (ORCPT ); Mon, 5 Oct 2015 07:03:08 -0400 Received: from mail-qg0-f44.google.com ([209.85.192.44]:36261 "EHLO mail-qg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbbJELDD (ORCPT ); Mon, 5 Oct 2015 07:03:03 -0400 Received: by qgx61 with SMTP id 61so145875519qgx.3 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=E8iRtdm3Szl4Wh3Otz32HS6GO52klZRp/REDgJ7isOhXG9H5EIzF5lcDQHq+36vjXw P6Y+9CixxX5zMv4d5Z5d+wW/MEs+c0+FJ1Q1ivgdi/GfK8nt0WfMunBBNBMCrhM1TAay 5NhjFC4avg18nivNsTgs+8gz1A/zXGMat/lvLnVlb7Uyyxs5EVm/4BAXcShFoQIrJbDQ 0WYRb2+I7jIr0dc43oHShS7iMNVoxAInQ+Db/zi++zOnhcc2C3xFGJeo4JXo0L0Lq0qz opdn/NEOL6Z5lBZI0ZN3DdmLQVLM3o+uyBBDl7+KrFYFyd4hb6/LRucgQvmkLaNrdPgE HBJw== X-Gm-Message-State: ALoCoQkGEaSW3myHRLPFI6S8G3iy67CQ8DdSn62pAwsN0H7WnBE+HuvW6StXdP7pPpQiUzk8p8PF 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-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 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; }