All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v2 07/33] NFS: Enable slot table helpers for NFSv4.0
Date: Fri, 09 Aug 2013 12:48:44 -0400	[thread overview]
Message-ID: <20130809164844.5362.23032.stgit@seurat.1015granger.net> (raw)
In-Reply-To: <20130809161957.5362.90865.stgit@seurat.1015granger.net>

I'd like to re-use NFSv4.1's slot table machinery for NFSv4.0
transport blocking.  Re-organize some of nfs4session.c so the slot
table code is built even when NFS_V4_1 is disabled.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/Makefile      |    4 ++--
 fs/nfs/nfs4session.c |   29 +++++++++++++++++++++--------
 fs/nfs/nfs4session.h |   28 +++++++++++++---------------
 fs/nfs/nfs4state.c   |    9 ---------
 4 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index e0bb048..2839bfe 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -21,10 +21,10 @@ nfsv3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
 obj-$(CONFIG_NFS_V4) += nfsv4.o
 nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
 	  delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \
-	  nfs4namespace.o nfs4getroot.o nfs4client.o dns_resolve.o
+	  nfs4namespace.o nfs4getroot.o nfs4client.o dns_resolve.o nfs4session.o
 nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
 nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
-nfsv4-$(CONFIG_NFS_V4_1)	+= nfs4session.o pnfs.o pnfs_dev.o
+nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o
 
 obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
 nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index 0161ad2..746675b 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -44,6 +44,17 @@ static void nfs4_shrink_slot_table(struct nfs4_slot_table  *tbl, u32 newsize)
 	}
 }
 
+/**
+ * nfs4_slot_tbl_drain_complete - wake waiters when drain is complete
+ * @tbl - controlling slot table
+ *
+ */
+void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl)
+{
+	if (nfs4_slot_tbl_draining(tbl))
+		complete(&tbl->complete);
+}
+
 /*
  * nfs4_free_slot - free a slot and efficiently update slot table.
  *
@@ -212,13 +223,6 @@ out:
 	return ret;
 }
 
-/* Destroy the slot table */
-static void nfs4_destroy_slot_tables(struct nfs4_session *session)
-{
-	nfs4_shrink_slot_table(&session->fc_slot_table, 0);
-	nfs4_shrink_slot_table(&session->bc_slot_table, 0);
-}
-
 static bool nfs41_assign_slot(struct rpc_task *task, void *pslot)
 {
 	struct nfs4_sequence_args *args = task->tk_msg.rpc_argp;
@@ -383,6 +387,15 @@ void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
 	spin_unlock(&tbl->slot_tbl_lock);
 }
 
+#if defined(CONFIG_NFS_V4_1)
+
+/* Destroy the slot table */
+static void nfs4_destroy_slot_tables(struct nfs4_session *session)
+{
+	nfs4_shrink_slot_table(&session->fc_slot_table, 0);
+	nfs4_shrink_slot_table(&session->bc_slot_table, 0);
+}
+
 /*
  * Initialize or reset the forechannel and backchannel tables
  */
@@ -513,4 +526,4 @@ int nfs4_init_ds_session(struct nfs_client *clp, unsigned long lease_time)
 }
 EXPORT_SYMBOL_GPL(nfs4_init_ds_session);
 
-
+#endif	/* defined(CONFIG_NFS_V4_1) */
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h
index 3a153d8..23d26b4 100644
--- a/fs/nfs/nfs4session.h
+++ b/fs/nfs/nfs4session.h
@@ -72,15 +72,24 @@ enum nfs4_session_state {
 	NFS4_SESSION_INITING,
 };
 
-#if defined(CONFIG_NFS_V4_1)
 extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl);
 extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot);
-
-extern void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
-		u32 target_highest_slotid);
+extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl);
 extern void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
 		struct nfs4_slot *slot,
 		struct nfs4_sequence_res *res);
+bool nfs41_wake_and_assign_slot(struct nfs4_slot_table *tbl,
+		struct nfs4_slot *slot);
+void nfs41_wake_slot_table(struct nfs4_slot_table *tbl);
+
+static inline bool nfs4_slot_tbl_draining(struct nfs4_slot_table *tbl)
+{
+	return !!test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state);
+}
+
+#if defined(CONFIG_NFS_V4_1)
+extern void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
+		u32 target_highest_slotid);
 
 extern int nfs4_setup_session_slot_tables(struct nfs4_session *ses);
 
@@ -89,17 +98,6 @@ extern void nfs4_destroy_session(struct nfs4_session *session);
 extern int nfs4_init_session(struct nfs_client *clp);
 extern int nfs4_init_ds_session(struct nfs_client *, unsigned long);
 
-extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl);
-
-static inline bool nfs4_slot_tbl_draining(struct nfs4_slot_table *tbl)
-{
-	return !!test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state);
-}
-
-bool nfs41_wake_and_assign_slot(struct nfs4_slot_table *tbl,
-		struct nfs4_slot *slot);
-void nfs41_wake_slot_table(struct nfs4_slot_table *tbl);
-
 /*
  * Determine if sessions are in use.
  */
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6818964..8826df3 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -260,15 +260,6 @@ static void nfs4_end_drain_session(struct nfs_client *clp)
 	}
 }
 
-/*
- * Signal state manager thread if session fore channel is drained
- */
-void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl)
-{
-	if (nfs4_slot_tbl_draining(tbl))
-		complete(&tbl->complete);
-}
-
 static int nfs4_drain_slot_tbl(struct nfs4_slot_table *tbl)
 {
 	set_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state);


  parent reply	other threads:[~2013-08-09 16:48 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 16:47 [PATCH v2 00/33] Proposed migration patches for 3.12 Chuck Lever
2013-08-09 16:47 ` [PATCH v2 01/33] NFS: When displaying session slot numbers, use "%u" consistently Chuck Lever
2013-08-09 16:48 ` [PATCH v2 02/33] NFS: Rename nfs41_call_sync_data as a common data structure Chuck Lever
2013-08-09 16:48 ` [PATCH v2 03/33] NFS: Clean up nfs4_setup_sequence() Chuck Lever
2013-08-09 16:48 ` [PATCH v2 04/33] NFS: Common versions of sequence helper functions Chuck Lever
2013-08-09 16:48 ` [PATCH v2 05/33] NFS: Add RPC callouts to start NFSv4.0 synchronous requests Chuck Lever
2013-08-09 16:48 ` [PATCH v2 06/33] NFS: Remove unused call_sync minor version op Chuck Lever
2013-08-09 16:48 ` Chuck Lever [this message]
2013-09-03 16:50   ` [PATCH v2 07/33] NFS: Enable slot table helpers for NFSv4.0 Myklebust, Trond
2013-09-03 18:19     ` Chuck Lever
2013-08-09 16:48 ` [PATCH v2 08/33] NFS: Add global helper to set up a stand-along nfs4_slot_table Chuck Lever
2013-08-09 16:49 ` [PATCH v2 09/33] NFS: Add global helper for releasing slot table resources Chuck Lever
2013-08-09 16:49 ` [PATCH v2 10/33] NFS: Add a slot table to struct nfs_client for NFSv4.0 transport blocking Chuck Lever
2013-08-09 16:49 ` [PATCH v2 11/33] NFS: " Chuck Lever
2013-08-09 16:49 ` [PATCH v2 12/33] NFS: Enable nfs4_setup_sequence() for DELEGRETURN Chuck Lever
2013-08-09 16:49 ` [PATCH v2 13/33] NFS: Add nfs4_sequence calls for RELEASE_LOCKOWNER Chuck Lever
2013-08-09 16:49 ` [PATCH v2 14/33] NFS: Add nfs4_sequence calls for OPEN_CONFIRM Chuck Lever
2013-08-09 16:49 ` [PATCH v2 15/33] NFS: Update session draining barriers for NFSv4.0 transport blocking Chuck Lever
2013-09-03 17:52   ` Myklebust, Trond
2013-09-03 17:57     ` Chuck Lever
2013-08-09 16:50 ` [PATCH v2 16/33] SUNRPC: Modify synopsis of rpc_client_register() Chuck Lever
2013-09-03 18:04   ` Myklebust, Trond
2013-09-03 18:16     ` Chuck Lever
2013-09-03 18:23       ` Myklebust, Trond
2013-09-03 18:33         ` Chuck Lever
2013-08-09 16:50 ` [PATCH v2 17/33] SUNRPC: Add a helper to switch the transport of an rpc_clnt Chuck Lever
2013-08-09 16:50 ` [PATCH v2 18/33] NFS: Add nfs4_update_server Chuck Lever
2013-08-09 16:50 ` [PATCH v2 19/33] NFS: Add functions to swap transports during migration recovery Chuck Lever
2013-08-09 16:50 ` [PATCH v2 20/33] NFS: Introduce a vector of migration recovery ops Chuck Lever
2013-08-09 16:50 ` [PATCH v2 21/33] NFS: Export _nfs_display_fhandle() Chuck Lever
2013-08-09 16:50 ` [PATCH v2 22/33] NFS: Add method to retrieve fs_locations during migration recovery Chuck Lever
2013-08-09 16:51 ` [PATCH v2 23/33] NFS: Add a super_block backpointer to the nfs_server struct Chuck Lever
2013-08-09 16:51 ` [PATCH v2 24/33] NFS: Add basic migration support to state manager thread Chuck Lever
2013-08-09 16:51 ` [PATCH v2 25/33] NFS: Re-use exit code in nfs4_async_handle_error() Chuck Lever
2013-08-09 16:51 ` [PATCH v2 26/33] NFS: Rename "stateid_invalid" label Chuck Lever
2013-08-09 16:51 ` [PATCH v2 27/33] NFS: Add migration recovery callouts in nfs4proc.c Chuck Lever
2013-08-09 16:51 ` [PATCH v2 28/33] NFS: Add method to detect whether an FSID is still on the server Chuck Lever
2013-08-09 16:52 ` [PATCH v2 29/33] NFS: Implement support for NFS4ERR_LEASE_MOVED in state manager Chuck Lever
2013-08-09 16:52 ` [PATCH v2 30/33] NFS: Implement support for NFS4ERR_LEASE_MOVED Chuck Lever
2013-08-09 16:52 ` [PATCH v2 31/33] " Chuck Lever
2013-08-09 16:52 ` [PATCH v2 32/33] NFS: Implement NFSv4.1 " Chuck Lever
2013-08-09 16:52 ` [PATCH v2 33/33] NFS: Set EXCHGID4_FLAG_SUPP_MOVED_MIGR Chuck Lever

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=20130809164844.5362.23032.stgit@seurat.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.