From patchwork Fri Sep 11 10:54: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: 7159411 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 7D9379F380 for ; Fri, 11 Sep 2015 10:55:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFB262085A for ; Fri, 11 Sep 2015 10:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF97B20855 for ; Fri, 11 Sep 2015 10:55:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752804AbbIKKzK (ORCPT ); Fri, 11 Sep 2015 06:55:10 -0400 Received: from mail-yk0-f176.google.com ([209.85.160.176]:36833 "EHLO mail-yk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752797AbbIKKzD (ORCPT ); Fri, 11 Sep 2015 06:55:03 -0400 Received: by ykdt18 with SMTP id t18so66774418ykd.3 for ; Fri, 11 Sep 2015 03:55: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=oEmWD+Qvs9UXA3/JefGrbByNUCpvURILvoxFdnEv300=; b=m8/hTZEhUy0OZ2WskA5Unx3RzWzfwMEmAsNecp9fKVkSqwKQ7VYmUtBuh0yZM6hKKU SaPG0vxYQyYHYuMv0d6FE59Q5HgLAprNbCZ0xw4u7NV9yPQNMqVkak0gUjYn99+mWHIA nocaTtzdaldv85pqjzMci1SYWB+ia4zi7OSjoa9XhdJxbTu0lEz+r8Nz1K8Epf8CirFS zoZyxDPoCxlFLleEM4tHplWAKBiR2zoiJCtog58dddbGVlZxVHPk92A3uIYC9VmMHIy4 UDyFFRdXvzZ1BXa3q20v4Y83J3zGKcywTJyZH7/t0F354gWEBquTJogw7yt9gJDwkjGl qhQg== X-Gm-Message-State: ALoCoQkyuCrBdr7lHIaHkJQiJHxI0AQB/D3uD/PsMBjKUg0PSP81VllMGpFHzBhM36nvFEqxg8Xf X-Received: by 10.13.202.66 with SMTP id m63mr7935796ywd.105.1441968902870; Fri, 11 Sep 2015 03:55:02 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1105:8e:3a60:77ff:fe93:a95d]) by smtp.googlemail.com with ESMTPSA id u8sm489915ywe.17.2015.09.11.03.55.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 03:55: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 Subject: [PATCH v4 10/16] nfsd: hook up nfsd_read to the nfsd_file cache Date: Fri, 11 Sep 2015 06:54:36 -0400 Message-Id: <1441968882-7851-11-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441968882-7851-1-git-send-email-jeff.layton@primarydata.com> References: <1441968882-7851-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 0a9bffe5ba97..af942ff4546f 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -987,20 +987,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; }