Return-Path: Received: from mail-yk0-f169.google.com ([209.85.160.169]:35792 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbbHTLRf (ORCPT ); Thu, 20 Aug 2015 07:17:35 -0400 Received: by ykbi184 with SMTP id i184so33653531ykb.2 for ; Thu, 20 Aug 2015 04:17:34 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@lst.de, kinglongmee@gmail.com Subject: [PATCH v3 08/20] nfsd: hook up nfsd_read to the nfsd_file cache Date: Thu, 20 Aug 2015 07:17:08 -0400 Message-Id: <1440069440-27454-9-git-send-email-jeff.layton@primarydata.com> 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 List-ID: 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 7c1e7866fec9..eb64597f3bde 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -980,20 +980,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; } -- 2.4.3