From: Christoph Hellwig <hch@lst.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@primarydata.com>,
Sachin Bhamare <sachin.bhamare@primarydata.com>,
linux-nfs@vger.kernel.org
Subject: [PATCH 2/2] nfsd: don't allocate odstates unless pNFS is enabled
Date: Tue, 28 Apr 2015 14:00:49 +0200 [thread overview]
Message-ID: <1430222449-3921-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1430222449-3921-1-git-send-email-hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/nfsd/nfs4state.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f417362..9072964 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -475,8 +475,10 @@ static void nfs4_file_put_access(struct nfs4_file *fp, u32 access)
/*
* Allocate a new open/delegation state counter. This is needed for
- * pNFS for proper return on close semantics. For v4.0 however, it's
- * not needed.
+ * pNFS for proper return on close semantics.
+ *
+ * Note that we only allocate it for pNFS-enabled exports, otherwise
+ * all pointers to struct nfs4_clnt_odstate are always NULL.
*/
static struct nfs4_clnt_odstate *
alloc_clnt_odstate(struct nfs4_client *clp)
@@ -503,7 +505,6 @@ hash_clnt_odstate_locked(struct nfs4_clnt_odstate *co)
static inline void
get_clnt_odstate(struct nfs4_clnt_odstate *co)
{
- /* This is always NULL in v4.0 */
if (co)
atomic_inc(&co->co_odcount);
}
@@ -513,7 +514,6 @@ put_clnt_odstate(struct nfs4_clnt_odstate *co)
{
struct nfs4_file *fp;
- /* This is always NULL in v4.0 */
if (!co)
return;
@@ -533,7 +533,6 @@ find_or_hash_clnt_odstate(struct nfs4_file *fp, struct nfs4_clnt_odstate *new)
struct nfs4_clnt_odstate *co;
struct nfs4_client *cl;
- /* This is always NULL in v4.0 */
if (!new)
return NULL;
@@ -3680,7 +3679,8 @@ alloc_stateid:
if (!open->op_stp)
return nfserr_jukebox;
- if (nfsd4_has_session(cstate)) {
+ if (nfsd4_has_session(cstate) &&
+ (cstate->current_fh.fh_export->ex_flags & NFSEXP_PNFS)) {
open->op_odstate = alloc_clnt_odstate(clp);
if (!open->op_odstate)
return nfserr_jukebox;
--
1.9.1
next prev parent reply other threads:[~2015-04-28 12:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 12:00 two odstate optimizations Christoph Hellwig
2015-04-28 12:00 ` [PATCH 1/2] nfsd: add a slab cache for odstate structures Christoph Hellwig
2015-04-28 12:00 ` Christoph Hellwig [this message]
2015-04-28 12:50 ` two odstate optimizations Jeff Layton
2015-04-28 16:31 ` J. Bruce Fields
[not found] ` <CANMZn7___SXopxOB-dO0fBj3keVrkXOTwLaYPazzVLHGtgLvPw@mail.gmail.com>
2015-04-29 14:24 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430222449-3921-3-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=bfields@fieldses.org \
--cc=jlayton@primarydata.com \
--cc=linux-nfs@vger.kernel.org \
--cc=sachin.bhamare@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).