Commit e8f5d77c authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b5627943
...@@ -118,6 +118,7 @@ struct rpc_call_ops { ...@@ -118,6 +118,7 @@ struct rpc_call_ops {
}; };
struct rpc_task_setup { struct rpc_task_setup {
struct rpc_task *task;
struct rpc_clnt *rpc_client; struct rpc_clnt *rpc_client;
const struct rpc_message *rpc_message; const struct rpc_message *rpc_message;
const struct rpc_call_ops *callback_ops; const struct rpc_call_ops *callback_ops;
......
...@@ -885,16 +885,20 @@ static void rpc_free_task(struct rcu_head *rcu) ...@@ -885,16 +885,20 @@ static void rpc_free_task(struct rcu_head *rcu)
*/ */
struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data)
{ {
struct rpc_task *task; struct rpc_task *task = setup_data->task;
unsigned short flags = 0;
if (task == NULL) {
task = rpc_alloc_task(); task = rpc_alloc_task();
if (!task) if (task == NULL)
goto out; goto out;
flags = RPC_TASK_DYNAMIC;
}
rpc_init_task(task, setup_data); rpc_init_task(task, setup_data);
task->tk_flags |= flags;
dprintk("RPC: allocated task %p\n", task); dprintk("RPC: allocated task %p\n", task);
task->tk_flags |= RPC_TASK_DYNAMIC;
out: out:
return task; return task;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment