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 /net/sunrpc/sched.c | |
parent | b5627943ab6fabbc13a45d92683363a3d08a249f (diff) | |
download | op-kernel-dev-e8f5d77c8029ff8f5dcd1dfc133aac0bbbffd92b.zip op-kernel-dev-e8f5d77c8029ff8f5dcd1dfc133aac0bbbffd92b.tar.gz |
SUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r-- | net/sunrpc/sched.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index fa53a88..c03e7bf 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -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 *task; - - task = rpc_alloc_task(); - if (!task) - goto out; + struct rpc_task *task = setup_data->task; + unsigned short flags = 0; + + if (task == NULL) { + task = rpc_alloc_task(); + if (task == NULL) + goto out; + flags = RPC_TASK_DYNAMIC; + } rpc_init_task(task, setup_data); + task->tk_flags |= flags; dprintk("RPC: allocated task %p\n", task); - task->tk_flags |= RPC_TASK_DYNAMIC; out: return task; } |