diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-25 18:42:53 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:38 -0500 |
| commit | e8f5d77c8029ff8f5dcd1dfc133aac0bbbffd92b (patch) | |
| tree | 590563991cc37325ef6c346745f0163c329e3e2c | |
| parent | b5627943ab6fabbc13a45d92683363a3d08a249f (diff) | |
SUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | include/linux/sunrpc/sched.h | 1 | ||||
| -rw-r--r-- | net/sunrpc/sched.c | 16 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index c9444fdc23ac..60a05c71637e 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -118,6 +118,7 @@ struct rpc_call_ops { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | struct rpc_task_setup { | 120 | struct rpc_task_setup { |
| 121 | struct rpc_task *task; | ||
| 121 | struct rpc_clnt *rpc_client; | 122 | struct rpc_clnt *rpc_client; |
| 122 | const struct rpc_message *rpc_message; | 123 | const struct rpc_message *rpc_message; |
| 123 | const struct rpc_call_ops *callback_ops; | 124 | const struct rpc_call_ops *callback_ops; |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index fa53a88b2c5b..c03e7bf6e9bc 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
| @@ -885,16 +885,20 @@ static void rpc_free_task(struct rcu_head *rcu) | |||
| 885 | */ | 885 | */ |
| 886 | struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) | 886 | struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) |
| 887 | { | 887 | { |
| 888 | struct rpc_task *task; | 888 | struct rpc_task *task = setup_data->task; |
| 889 | 889 | unsigned short flags = 0; | |
| 890 | task = rpc_alloc_task(); | 890 | |
| 891 | if (!task) | 891 | if (task == NULL) { |
| 892 | goto out; | 892 | task = rpc_alloc_task(); |
| 893 | if (task == NULL) | ||
| 894 | goto out; | ||
| 895 | flags = RPC_TASK_DYNAMIC; | ||
| 896 | } | ||
| 893 | 897 | ||
| 894 | rpc_init_task(task, setup_data); | 898 | rpc_init_task(task, setup_data); |
| 895 | 899 | ||
| 900 | task->tk_flags |= flags; | ||
| 896 | dprintk("RPC: allocated task %p\n", task); | 901 | dprintk("RPC: allocated task %p\n", task); |
| 897 | task->tk_flags |= RPC_TASK_DYNAMIC; | ||
| 898 | out: | 902 | out: |
| 899 | return task; | 903 | return task; |
| 900 | } | 904 | } |
