aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/sched.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-16 14:17:01 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:28 -0400
commitc44fe705530ff9ea5e563bf9b65bdd29defe682b (patch)
tree8f4a7eaf29d5d6e1752f5807bc9e9e27d2256f67 /net/sunrpc/sched.c
parent4bef61ff7514396419563ca54fd42ef846485b06 (diff)
SUNRPC: Clean up tk_pid allocation and make it lockless
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r--net/sunrpc/sched.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f56ebc5a08f7..0e9fbbd4f987 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -25,7 +25,6 @@
25#ifdef RPC_DEBUG 25#ifdef RPC_DEBUG
26#define RPCDBG_FACILITY RPCDBG_SCHED 26#define RPCDBG_FACILITY RPCDBG_SCHED
27#define RPC_TASK_MAGIC_ID 0xf00baa 27#define RPC_TASK_MAGIC_ID 0xf00baa
28static int rpc_task_id;
29#endif 28#endif
30 29
31/* 30/*
@@ -268,17 +267,26 @@ static int rpc_wait_bit_interruptible(void *word)
268 return 0; 267 return 0;
269} 268}
270 269
270#ifdef RPC_DEBUG
271static void rpc_task_set_debuginfo(struct rpc_task *task)
272{
273 static atomic_t rpc_pid;
274
275 task->tk_magic = RPC_TASK_MAGIC_ID;
276 task->tk_pid = atomic_inc_return(&rpc_pid);
277}
278#else
279static inline void rpc_task_set_debuginfo(struct rpc_task *task)
280{
281}
282#endif
283
271static void rpc_set_active(struct rpc_task *task) 284static void rpc_set_active(struct rpc_task *task)
272{ 285{
273 struct rpc_clnt *clnt; 286 struct rpc_clnt *clnt;
274 if (test_and_set_bit(RPC_TASK_ACTIVE, &task->tk_runstate) != 0) 287 if (test_and_set_bit(RPC_TASK_ACTIVE, &task->tk_runstate) != 0)
275 return; 288 return;
276#ifdef RPC_DEBUG 289 rpc_task_set_debuginfo(task);
277 task->tk_magic = RPC_TASK_MAGIC_ID;
278 spin_lock(&rpc_sched_lock);
279 task->tk_pid = rpc_task_id++;
280 spin_unlock(&rpc_sched_lock);
281#endif
282 /* Add to global list of all tasks */ 290 /* Add to global list of all tasks */
283 clnt = task->tk_client; 291 clnt = task->tk_client;
284 if (clnt != NULL) { 292 if (clnt != NULL) {