aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/direct.c36
-rw-r--r--fs/nfs/read.c15
-rw-r--r--fs/nfs/write.c30
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/sched.h14
-rw-r--r--net/sunrpc/clnt.c51
-rw-r--r--net/sunrpc/sched.c27
7 files changed, 117 insertions, 58 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 3c9d16b4f80c..f9f5fc13dc7d 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -272,6 +272,11 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
272 unsigned long user_addr = (unsigned long)iov->iov_base; 272 unsigned long user_addr = (unsigned long)iov->iov_base;
273 size_t count = iov->iov_len; 273 size_t count = iov->iov_len;
274 size_t rsize = NFS_SERVER(inode)->rsize; 274 size_t rsize = NFS_SERVER(inode)->rsize;
275 struct rpc_task_setup task_setup_data = {
276 .rpc_client = NFS_CLIENT(inode),
277 .callback_ops = &nfs_read_direct_ops,
278 .flags = RPC_TASK_ASYNC,
279 };
275 unsigned int pgbase; 280 unsigned int pgbase;
276 int result; 281 int result;
277 ssize_t started = 0; 282 ssize_t started = 0;
@@ -322,8 +327,8 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
322 data->res.eof = 0; 327 data->res.eof = 0;
323 data->res.count = bytes; 328 data->res.count = bytes;
324 329
325 rpc_init_task(&data->task, NFS_CLIENT(inode), RPC_TASK_ASYNC, 330 task_setup_data.callback_data = data;
326 &nfs_read_direct_ops, data); 331 rpc_init_task(&data->task, &task_setup_data);
327 NFS_PROTO(inode)->read_setup(data); 332 NFS_PROTO(inode)->read_setup(data);
328 333
329 data->task.tk_cookie = (unsigned long) inode; 334 data->task.tk_cookie = (unsigned long) inode;
@@ -431,6 +436,11 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
431 struct inode *inode = dreq->inode; 436 struct inode *inode = dreq->inode;
432 struct list_head *p; 437 struct list_head *p;
433 struct nfs_write_data *data; 438 struct nfs_write_data *data;
439 struct rpc_task_setup task_setup_data = {
440 .rpc_client = NFS_CLIENT(inode),
441 .callback_ops = &nfs_write_direct_ops,
442 .flags = RPC_TASK_ASYNC,
443 };
434 444
435 dreq->count = 0; 445 dreq->count = 0;
436 get_dreq(dreq); 446 get_dreq(dreq);
@@ -451,8 +461,8 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
451 * Reuse data->task; data->args should not have changed 461 * Reuse data->task; data->args should not have changed
452 * since the original request was sent. 462 * since the original request was sent.
453 */ 463 */
454 rpc_init_task(&data->task, NFS_CLIENT(inode), RPC_TASK_ASYNC, 464 task_setup_data.callback_data = data;
455 &nfs_write_direct_ops, data); 465 rpc_init_task(&data->task, &task_setup_data);
456 NFS_PROTO(inode)->write_setup(data, FLUSH_STABLE); 466 NFS_PROTO(inode)->write_setup(data, FLUSH_STABLE);
457 467
458 data->task.tk_priority = RPC_PRIORITY_NORMAL; 468 data->task.tk_priority = RPC_PRIORITY_NORMAL;
@@ -504,6 +514,12 @@ static const struct rpc_call_ops nfs_commit_direct_ops = {
504static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) 514static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
505{ 515{
506 struct nfs_write_data *data = dreq->commit_data; 516 struct nfs_write_data *data = dreq->commit_data;
517 struct rpc_task_setup task_setup_data = {
518 .rpc_client = NFS_CLIENT(dreq->inode),
519 .callback_ops = &nfs_commit_direct_ops,
520 .callback_data = data,
521 .flags = RPC_TASK_ASYNC,
522 };
507 523
508 data->inode = dreq->inode; 524 data->inode = dreq->inode;
509 data->cred = dreq->ctx->cred; 525 data->cred = dreq->ctx->cred;
@@ -515,8 +531,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
515 data->res.fattr = &data->fattr; 531 data->res.fattr = &data->fattr;
516 data->res.verf = &data->verf; 532 data->res.verf = &data->verf;
517 533
518 rpc_init_task(&data->task, NFS_CLIENT(dreq->inode), RPC_TASK_ASYNC, 534 rpc_init_task(&data->task, &task_setup_data);
519 &nfs_commit_direct_ops, data);
520 NFS_PROTO(data->inode)->commit_setup(data, 0); 535 NFS_PROTO(data->inode)->commit_setup(data, 0);
521 536
522 data->task.tk_priority = RPC_PRIORITY_NORMAL; 537 data->task.tk_priority = RPC_PRIORITY_NORMAL;
@@ -641,6 +656,11 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
641 struct inode *inode = ctx->path.dentry->d_inode; 656 struct inode *inode = ctx->path.dentry->d_inode;
642 unsigned long user_addr = (unsigned long)iov->iov_base; 657 unsigned long user_addr = (unsigned long)iov->iov_base;
643 size_t count = iov->iov_len; 658 size_t count = iov->iov_len;
659 struct rpc_task_setup task_setup_data = {
660 .rpc_client = NFS_CLIENT(inode),
661 .callback_ops = &nfs_write_direct_ops,
662 .flags = RPC_TASK_ASYNC,
663 };
644 size_t wsize = NFS_SERVER(inode)->wsize; 664 size_t wsize = NFS_SERVER(inode)->wsize;
645 unsigned int pgbase; 665 unsigned int pgbase;
646 int result; 666 int result;
@@ -694,8 +714,8 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
694 data->res.count = bytes; 714 data->res.count = bytes;
695 data->res.verf = &data->verf; 715 data->res.verf = &data->verf;
696 716
697 rpc_init_task(&data->task, NFS_CLIENT(inode), RPC_TASK_ASYNC, 717 task_setup_data.callback_data = data;
698 &nfs_write_direct_ops, data); 718 rpc_init_task(&data->task, &task_setup_data);
699 NFS_PROTO(inode)->write_setup(data, sync); 719 NFS_PROTO(inode)->write_setup(data, sync);
700 720
701 data->task.tk_priority = RPC_PRIORITY_NORMAL; 721 data->task.tk_priority = RPC_PRIORITY_NORMAL;
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 4587a86adaac..c7f0d5ebd451 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -160,11 +160,17 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
160 const struct rpc_call_ops *call_ops, 160 const struct rpc_call_ops *call_ops,
161 unsigned int count, unsigned int offset) 161 unsigned int count, unsigned int offset)
162{ 162{
163 struct inode *inode; 163 struct inode *inode = req->wb_context->path.dentry->d_inode;
164 int flags; 164 int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
165 struct rpc_task_setup task_setup_data = {
166 .rpc_client = NFS_CLIENT(inode),
167 .callback_ops = call_ops,
168 .callback_data = data,
169 .flags = RPC_TASK_ASYNC | swap_flags,
170 };
165 171
166 data->req = req; 172 data->req = req;
167 data->inode = inode = req->wb_context->path.dentry->d_inode; 173 data->inode = inode;
168 data->cred = req->wb_context->cred; 174 data->cred = req->wb_context->cred;
169 175
170 data->args.fh = NFS_FH(inode); 176 data->args.fh = NFS_FH(inode);
@@ -180,8 +186,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
180 nfs_fattr_init(&data->fattr); 186 nfs_fattr_init(&data->fattr);
181 187
182 /* Set up the initial task struct. */ 188 /* Set up the initial task struct. */
183 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); 189 rpc_init_task(&data->task, &task_setup_data);
184 rpc_init_task(&data->task, NFS_CLIENT(inode), flags, call_ops, data);
185 NFS_PROTO(inode)->read_setup(data); 190 NFS_PROTO(inode)->read_setup(data);
186 191
187 data->task.tk_cookie = (unsigned long)inode; 192 data->task.tk_cookie = (unsigned long)inode;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 092e79c6d962..c4376606f106 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -773,8 +773,14 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
773 unsigned int count, unsigned int offset, 773 unsigned int count, unsigned int offset,
774 int how) 774 int how)
775{ 775{
776 struct inode *inode; 776 struct inode *inode = req->wb_context->path.dentry->d_inode;
777 int flags; 777 int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
778 struct rpc_task_setup task_setup_data = {
779 .rpc_client = NFS_CLIENT(inode),
780 .callback_ops = call_ops,
781 .callback_data = data,
782 .flags = flags,
783 };
778 784
779 /* Set up the RPC argument and reply structs 785 /* Set up the RPC argument and reply structs
780 * NB: take care not to mess about with data->commit et al. */ 786 * NB: take care not to mess about with data->commit et al. */
@@ -796,8 +802,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
796 nfs_fattr_init(&data->fattr); 802 nfs_fattr_init(&data->fattr);
797 803
798 /* Set up the initial task struct. */ 804 /* Set up the initial task struct. */
799 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 805 rpc_init_task(&data->task, &task_setup_data);
800 rpc_init_task(&data->task, NFS_CLIENT(inode), flags, call_ops, data);
801 NFS_PROTO(inode)->write_setup(data, how); 806 NFS_PROTO(inode)->write_setup(data, how);
802 807
803 data->task.tk_priority = flush_task_priority(how); 808 data->task.tk_priority = flush_task_priority(how);
@@ -1144,16 +1149,20 @@ static void nfs_commit_rpcsetup(struct list_head *head,
1144 struct nfs_write_data *data, 1149 struct nfs_write_data *data,
1145 int how) 1150 int how)
1146{ 1151{
1147 struct nfs_page *first; 1152 struct nfs_page *first = nfs_list_entry(head->next);
1148 struct inode *inode; 1153 struct inode *inode = first->wb_context->path.dentry->d_inode;
1149 int flags; 1154 int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
1155 struct rpc_task_setup task_setup_data = {
1156 .rpc_client = NFS_CLIENT(inode),
1157 .callback_ops = &nfs_commit_ops,
1158 .callback_data = data,
1159 .flags = flags,
1160 };
1150 1161
1151 /* Set up the RPC argument and reply structs 1162 /* Set up the RPC argument and reply structs
1152 * NB: take care not to mess about with data->commit et al. */ 1163 * NB: take care not to mess about with data->commit et al. */
1153 1164
1154 list_splice_init(head, &data->pages); 1165 list_splice_init(head, &data->pages);
1155 first = nfs_list_entry(data->pages.next);
1156 inode = first->wb_context->path.dentry->d_inode;
1157 1166
1158 data->inode = inode; 1167 data->inode = inode;
1159 data->cred = first->wb_context->cred; 1168 data->cred = first->wb_context->cred;
@@ -1168,8 +1177,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
1168 nfs_fattr_init(&data->fattr); 1177 nfs_fattr_init(&data->fattr);
1169 1178
1170 /* Set up the initial task struct. */ 1179 /* Set up the initial task struct. */
1171 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 1180 rpc_init_task(&data->task, &task_setup_data);
1172 rpc_init_task(&data->task, NFS_CLIENT(inode), flags, &nfs_commit_ops, data);
1173 NFS_PROTO(inode)->commit_setup(data, how); 1181 NFS_PROTO(inode)->commit_setup(data, how);
1174 1182
1175 data->task.tk_priority = flush_task_priority(how); 1183 data->task.tk_priority = flush_task_priority(how);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index d9d5c5ad826c..ec9704181f94 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -126,7 +126,7 @@ int rpcb_register(u32, u32, int, unsigned short, int *);
126int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int); 126int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int);
127void rpcb_getport_async(struct rpc_task *); 127void rpcb_getport_async(struct rpc_task *);
128 128
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 129void rpc_call_setup(struct rpc_task *, const struct rpc_message *, int);
130 130
131int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 131int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
132 int flags, const struct rpc_call_ops *tk_ops, 132 int flags, const struct rpc_call_ops *tk_ops,
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8ea077db0099..9efe045fc376 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -117,6 +117,13 @@ struct rpc_call_ops {
117 void (*rpc_release)(void *); 117 void (*rpc_release)(void *);
118}; 118};
119 119
120struct rpc_task_setup {
121 struct rpc_clnt *rpc_client;
122 const struct rpc_message *rpc_message;
123 const struct rpc_call_ops *callback_ops;
124 void *callback_data;
125 unsigned short flags;
126};
120 127
121/* 128/*
122 * RPC task flags 129 * RPC task flags
@@ -236,13 +243,10 @@ struct rpc_wait_queue {
236/* 243/*
237 * Function prototypes 244 * Function prototypes
238 */ 245 */
239struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, 246struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
240 const struct rpc_call_ops *ops, void *data);
241struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, 247struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
242 const struct rpc_call_ops *ops, void *data); 248 const struct rpc_call_ops *ops, void *data);
243void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, 249void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *);
244 int flags, const struct rpc_call_ops *ops,
245 void *data);
246void rpc_put_task(struct rpc_task *); 250void rpc_put_task(struct rpc_task *);
247void rpc_exit_task(struct rpc_task *); 251void rpc_exit_task(struct rpc_task *);
248void rpc_release_calldata(const struct rpc_call_ops *, void *); 252void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 22092b91dd85..7c80abd9263f 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -524,25 +524,22 @@ void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
524EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask); 524EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask);
525 525
526static 526static
527struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, 527struct rpc_task *rpc_do_run_task(const struct rpc_task_setup *task_setup_data)
528 struct rpc_message *msg,
529 int flags,
530 const struct rpc_call_ops *ops,
531 void *data)
532{ 528{
533 struct rpc_task *task, *ret; 529 struct rpc_task *task, *ret;
534 sigset_t oldset; 530 sigset_t oldset;
535 531
536 task = rpc_new_task(clnt, flags, ops, data); 532 task = rpc_new_task(task_setup_data);
537 if (task == NULL) { 533 if (task == NULL) {
538 rpc_release_calldata(ops, data); 534 rpc_release_calldata(task_setup_data->callback_ops,
535 task_setup_data->callback_data);
539 return ERR_PTR(-ENOMEM); 536 return ERR_PTR(-ENOMEM);
540 } 537 }
541 538
542 /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */ 539 /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
543 rpc_task_sigmask(task, &oldset); 540 rpc_task_sigmask(task, &oldset);
544 if (msg != NULL) { 541 if (task_setup_data->rpc_message != NULL) {
545 rpc_call_setup(task, msg, 0); 542 rpc_call_setup(task, task_setup_data->rpc_message, 0);
546 if (task->tk_status != 0) { 543 if (task->tk_status != 0) {
547 ret = ERR_PTR(task->tk_status); 544 ret = ERR_PTR(task->tk_status);
548 rpc_put_task(task); 545 rpc_put_task(task);
@@ -566,11 +563,17 @@ out:
566int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) 563int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
567{ 564{
568 struct rpc_task *task; 565 struct rpc_task *task;
566 struct rpc_task_setup task_setup_data = {
567 .rpc_client = clnt,
568 .rpc_message = msg,
569 .callback_ops = &rpc_default_ops,
570 .flags = flags,
571 };
569 int status; 572 int status;
570 573
571 BUG_ON(flags & RPC_TASK_ASYNC); 574 BUG_ON(flags & RPC_TASK_ASYNC);
572 575
573 task = rpc_do_run_task(clnt, msg, flags, &rpc_default_ops, NULL); 576 task = rpc_do_run_task(&task_setup_data);
574 if (IS_ERR(task)) 577 if (IS_ERR(task))
575 return PTR_ERR(task); 578 return PTR_ERR(task);
576 status = task->tk_status; 579 status = task->tk_status;
@@ -592,8 +595,15 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
592 const struct rpc_call_ops *tk_ops, void *data) 595 const struct rpc_call_ops *tk_ops, void *data)
593{ 596{
594 struct rpc_task *task; 597 struct rpc_task *task;
598 struct rpc_task_setup task_setup_data = {
599 .rpc_client = clnt,
600 .rpc_message = msg,
601 .callback_ops = tk_ops,
602 .callback_data = data,
603 .flags = flags|RPC_TASK_ASYNC,
604 };
595 605
596 task = rpc_do_run_task(clnt, msg, flags|RPC_TASK_ASYNC, tk_ops, data); 606 task = rpc_do_run_task(&task_setup_data);
597 if (IS_ERR(task)) 607 if (IS_ERR(task))
598 return PTR_ERR(task); 608 return PTR_ERR(task);
599 rpc_put_task(task); 609 rpc_put_task(task);
@@ -612,12 +622,19 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
612 const struct rpc_call_ops *tk_ops, 622 const struct rpc_call_ops *tk_ops,
613 void *data) 623 void *data)
614{ 624{
615 return rpc_do_run_task(clnt, NULL, flags, tk_ops, data); 625 struct rpc_task_setup task_setup_data = {
626 .rpc_client = clnt,
627 .callback_ops = tk_ops,
628 .callback_data = data,
629 .flags = flags,
630 };
631
632 return rpc_do_run_task(&task_setup_data);
616} 633}
617EXPORT_SYMBOL_GPL(rpc_run_task); 634EXPORT_SYMBOL_GPL(rpc_run_task);
618 635
619void 636void
620rpc_call_setup(struct rpc_task *task, struct rpc_message *msg, int flags) 637rpc_call_setup(struct rpc_task *task, const struct rpc_message *msg, int flags)
621{ 638{
622 task->tk_msg = *msg; 639 task->tk_msg = *msg;
623 task->tk_flags |= flags; 640 task->tk_flags |= flags;
@@ -1527,7 +1544,13 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
1527 .rpc_proc = &rpcproc_null, 1544 .rpc_proc = &rpcproc_null,
1528 .rpc_cred = cred, 1545 .rpc_cred = cred,
1529 }; 1546 };
1530 return rpc_do_run_task(clnt, &msg, flags, &rpc_default_ops, NULL); 1547 struct rpc_task_setup task_setup_data = {
1548 .rpc_client = clnt,
1549 .rpc_message = &msg,
1550 .callback_ops = &rpc_default_ops,
1551 .flags = flags,
1552 };
1553 return rpc_do_run_task(&task_setup_data);
1531} 1554}
1532EXPORT_SYMBOL_GPL(rpc_call_null); 1555EXPORT_SYMBOL_GPL(rpc_call_null);
1533 1556
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;