From: andros@netapp.com
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>
Subject: [PATCH Version 7 1/3] NFS4.1 clean up nfs4_alloc_session
Date: Sun, 12 Feb 2012 12:52:54 -0500 [thread overview]
Message-ID: <1329069176-8349-2-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1329069176-8349-1-git-send-email-andros@netapp.com>
From: Andy Adamson <andros@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfs/nfs4proc.c | 39 ++++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d202e04..18b095a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5061,9 +5061,9 @@ static void nfs4_destroy_slot_tables(struct nfs4_session *session)
}
/*
- * Initialize slot table
+ * Set the initial slot table slots with CREATE_SESSION negotiated values
*/
-static int nfs4_init_slot_table(struct nfs4_slot_table *tbl,
+static int nfs4_set_slot_table(struct nfs4_slot_table *tbl,
int max_slots, int ivalue)
{
struct nfs4_slot *slot;
@@ -5091,7 +5091,7 @@ out:
}
/*
- * Initialize or reset the forechannel and backchannel tables
+ * Set or reset the forechannel and backchannel tables
*/
static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
{
@@ -5102,7 +5102,7 @@ static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
/* Fore channel */
tbl = &ses->fc_slot_table;
if (tbl->slots == NULL) {
- status = nfs4_init_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
+ status = nfs4_set_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
if (status) /* -ENOMEM */
return status;
} else {
@@ -5113,7 +5113,7 @@ static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
/* Back channel */
tbl = &ses->bc_slot_table;
if (tbl->slots == NULL) {
- status = nfs4_init_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
+ status = nfs4_set_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
if (status)
/* Fore and back channel share a connection so get
* both slot tables or neither */
@@ -5123,29 +5123,30 @@ static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
return status;
}
+void nfs4_init_slot_table(struct nfs4_slot_table *tbl, bool forechannel)
+{
+ spin_lock_init(&tbl->slot_tbl_lock);
+ if (forechannel)
+ rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq,
+ "ForeChannel Slot table");
+ else
+ rpc_init_wait_queue(&tbl->slot_tbl_waitq,
+ "BackChannel Slot table");
+ tbl->highest_used_slotid = -1; /* for drain session to work */
+ init_completion(&tbl->complete);
+}
+
struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
{
struct nfs4_session *session;
- struct nfs4_slot_table *tbl;
session = kzalloc(sizeof(struct nfs4_session), GFP_NOFS);
if (!session)
return NULL;
- tbl = &session->fc_slot_table;
- tbl->highest_used_slotid = -1;
- spin_lock_init(&tbl->slot_tbl_lock);
- rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table");
- init_completion(&tbl->complete);
-
- tbl = &session->bc_slot_table;
- tbl->highest_used_slotid = -1;
- spin_lock_init(&tbl->slot_tbl_lock);
- rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table");
- init_completion(&tbl->complete);
-
+ nfs4_init_slot_table(&session->fc_slot_table, true);
+ nfs4_init_slot_table(&session->bc_slot_table, false);
session->session_state = 1<<NFS4_SESSION_INITING;
-
session->clp = clp;
return session;
}
--
1.7.6.4
next prev parent reply other threads:[~2012-02-12 17:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-12 17:52 [PATCH Version 7] NFSv4.1 Prepare for dynamic session slots andros
2012-02-12 17:52 ` andros [this message]
2012-02-12 17:52 ` [PATCH Version 7 2/3] NFSv4.1 prepare " andros
2012-02-13 13:49 ` Bryan Schumaker
2012-02-12 17:52 ` [PATCH Version 7 3/3] NFSv4.1 avoid freeing slot when tasks are waiting andros
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=1329069176-8349-2-git-send-email-andros@netapp.com \
--to=andros@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.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).