]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
SUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 25 Oct 2007 22:42:53 +0000 (18:42 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 30 Jan 2008 07:05:38 +0000 (02:05 -0500)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/sched.h
net/sunrpc/sched.c

index c9444fdc23ac6f625970c9b675e8844d26841c63..60a05c71637e24dc5435a04748318aac1b02dcea 100644 (file)
@@ -118,6 +118,7 @@ struct rpc_call_ops {
 };
 
 struct rpc_task_setup {
+       struct rpc_task *task;
        struct rpc_clnt *rpc_client;
        const struct rpc_message *rpc_message;
        const struct rpc_call_ops *callback_ops;
index fa53a88b2c5bd4afd3a5869aaf4eb647c6776ac4..c03e7bf6e9bc673f90f62032faf77578acc58882 100644 (file)
@@ -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;
 }