aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/sched.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:39:59 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:30 -0500
commit84115e1cd4a3614c4e566d4cce31381dce3dbef9 (patch)
tree01b2de7163deb6b3a789811183d8b8c1329b900c /net/sunrpc/sched.c
parente8914c65f7f8d4e8701b8e78a12b714872ea0402 (diff)
SUNRPC: Cleanup of rpc_task initialisation
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r--net/sunrpc/sched.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index d0b4c7e11e06..10216989309c 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -815,18 +815,15 @@ EXPORT_SYMBOL_GPL(rpc_free);
815/* 815/*
816 * Creation and deletion of RPC task structures 816 * Creation and deletion of RPC task structures
817 */ 817 */
818void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *tk_ops, void *calldata) 818void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *task_setup_data)
819{ 819{
820 memset(task, 0, sizeof(*task)); 820 memset(task, 0, sizeof(*task));
821 setup_timer(&task->tk_timer, (void (*)(unsigned long))rpc_run_timer, 821 setup_timer(&task->tk_timer, (void (*)(unsigned long))rpc_run_timer,
822 (unsigned long)task); 822 (unsigned long)task);
823 atomic_set(&task->tk_count, 1); 823 atomic_set(&task->tk_count, 1);
824 task->tk_client = clnt; 824 task->tk_flags = task_setup_data->flags;
825 task->tk_flags = flags; 825 task->tk_ops = task_setup_data->callback_ops;
826 task->tk_ops = tk_ops; 826 task->tk_calldata = task_setup_data->callback_data;
827 if (tk_ops->rpc_call_prepare != NULL)
828 task->tk_action = rpc_prepare_task;
829 task->tk_calldata = calldata;
830 INIT_LIST_HEAD(&task->tk_task); 827 INIT_LIST_HEAD(&task->tk_task);
831 828
832 /* Initialize retry counters */ 829 /* Initialize retry counters */
@@ -839,15 +836,17 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
839 /* Initialize workqueue for async tasks */ 836 /* Initialize workqueue for async tasks */
840 task->tk_workqueue = rpciod_workqueue; 837 task->tk_workqueue = rpciod_workqueue;
841 838
842 if (clnt) { 839 task->tk_client = task_setup_data->rpc_client;
843 kref_get(&clnt->cl_kref); 840 if (task->tk_client != NULL) {
844 if (clnt->cl_softrtry) 841 kref_get(&task->tk_client->cl_kref);
842 if (task->tk_client->cl_softrtry)
845 task->tk_flags |= RPC_TASK_SOFT; 843 task->tk_flags |= RPC_TASK_SOFT;
846 if (!clnt->cl_intr) 844 if (!task->tk_client->cl_intr)
847 task->tk_flags |= RPC_TASK_NOINTR; 845 task->tk_flags |= RPC_TASK_NOINTR;
848 } 846 }
849 847
850 BUG_ON(task->tk_ops == NULL); 848 if (task->tk_ops->rpc_call_prepare != NULL)
849 task->tk_action = rpc_prepare_task;
851 850
852 /* starting timestamp */ 851 /* starting timestamp */
853 task->tk_start = jiffies; 852 task->tk_start = jiffies;
@@ -873,7 +872,7 @@ static void rpc_free_task(struct rcu_head *rcu)
873/* 872/*
874 * Create a new task for the specified client. 873 * Create a new task for the specified client.
875 */ 874 */
876struct rpc_task *rpc_new_task(struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *tk_ops, void *calldata) 875struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data)
877{ 876{
878 struct rpc_task *task; 877 struct rpc_task *task;
879 878
@@ -881,7 +880,7 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *clnt, int flags, const struct rpc
881 if (!task) 880 if (!task)
882 goto out; 881 goto out;
883 882
884 rpc_init_task(task, clnt, flags, tk_ops, calldata); 883 rpc_init_task(task, setup_data);
885 884
886 dprintk("RPC: allocated task %p\n", task); 885 dprintk("RPC: allocated task %p\n", task);
887 task->tk_flags |= RPC_TASK_DYNAMIC; 886 task->tk_flags |= RPC_TASK_DYNAMIC;