@@ -69,6 +69,37 @@ void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl)
}
}
+static int nfs4_wait_empty_slot_tbl(struct nfs4_slot_table *tbl)
+{
+ spin_lock(&tbl->slot_tbl_lock);
+ if (tbl->highest_used_slotid != NFS4_NO_SLOT) {
+ if (!test_and_set_bit(NFS4_SLOT_TBL_WAIT_EMPTY,
+ &tbl->slot_tbl_state))
+ reinit_completion(&tbl->complete);
+ spin_unlock(&tbl->slot_tbl_lock);
+ return wait_for_completion_interruptible(&tbl->complete);
+ }
+ spin_unlock(&tbl->slot_tbl_lock);
+ return 0;
+}
+
+int nfs4_drain_slot_tbl(struct nfs4_slot_table *tbl)
+{
+ /* Block new RPC calls */
+ set_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state);
+ /* Wait on outstanding RPC calls to complete */
+ return nfs4_wait_empty_slot_tbl(tbl);
+}
+
+void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl)
+{
+ if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) {
+ spin_lock(&tbl->slot_tbl_lock);
+ nfs41_wake_slot_table(tbl);
+ spin_unlock(&tbl->slot_tbl_lock);
+ }
+}
+
/*
* nfs4_free_slot - free a slot and efficiently update slot table.
*
@@ -250,7 +281,7 @@ static void nfs4_release_slot_table(struct nfs4_slot_table *tbl)
* @tbl: slot table to shut down
*
*/
-void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl)
+static void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl)
{
nfs4_release_slot_table(tbl);
rpc_destroy_wait_queue(&tbl->slot_tbl_waitq);
@@ -76,10 +76,10 @@ enum nfs4_session_state {
extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl,
unsigned int max_reqs, const char *queue);
-extern void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl);
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 int nfs4_wait_empty_slot_tbl(struct nfs4_slot_table *tbl);
+extern int nfs4_drain_slot_tbl(struct nfs4_slot_table *tbl);
+extern void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl);
extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl);
bool nfs41_wake_and_assign_slot(struct nfs4_slot_table *tbl,
struct nfs4_slot *slot);
@@ -215,15 +215,6 @@ out:
return cred;
}
-static void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl)
-{
- if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) {
- spin_lock(&tbl->slot_tbl_lock);
- nfs41_wake_slot_table(tbl);
- spin_unlock(&tbl->slot_tbl_lock);
- }
-}
-
static void nfs4_end_drain_session(struct nfs_client *clp)
{
struct nfs4_session *ses = clp->cl_session;
@@ -239,28 +230,6 @@ static void nfs4_end_drain_session(struct nfs_client *clp)
}
}
-int nfs4_wait_empty_slot_tbl(struct nfs4_slot_table *tbl)
-{
- spin_lock(&tbl->slot_tbl_lock);
- if (tbl->highest_used_slotid != NFS4_NO_SLOT) {
- if (!test_and_set_bit(NFS4_SLOT_TBL_WAIT_EMPTY,
- &tbl->slot_tbl_state))
- reinit_completion(&tbl->complete);
- spin_unlock(&tbl->slot_tbl_lock);
- return wait_for_completion_interruptible(&tbl->complete);
- }
- spin_unlock(&tbl->slot_tbl_lock);
- return 0;
-}
-
-int nfs4_drain_slot_tbl(struct nfs4_slot_table *tbl)
-{
- /* Block new RPC calls */
- set_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state);
- /* Wait on outstanding RPC calls to complete */
- return nfs4_wait_empty_slot_tbl(tbl);
-}
-
static int nfs4_begin_drain_session(struct nfs_client *clp)
{
struct nfs4_session *ses = clp->cl_session;
Also make nfs4_shutdown_slot_table() static now that it is no longer used outside nfs4session.c. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4session.c | 33 ++++++++++++++++++++++++++++++++- fs/nfs/nfs4session.h | 4 ++-- fs/nfs/nfs4state.c | 31 ------------------------------- 3 files changed, 34 insertions(+), 34 deletions(-)