aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 244d1bd7002c..eadd87f7159f 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -272,6 +272,7 @@ 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 *task;
275 struct rpc_message msg = { 276 struct rpc_message msg = {
276 .rpc_cred = ctx->cred, 277 .rpc_cred = ctx->cred,
277 }; 278 };
@@ -333,11 +334,13 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
333 msg.rpc_argp = &data->args; 334 msg.rpc_argp = &data->args;
334 msg.rpc_resp = &data->res; 335 msg.rpc_resp = &data->res;
335 336
337 task_setup_data.task = &data->task;
336 task_setup_data.callback_data = data; 338 task_setup_data.callback_data = data;
337 NFS_PROTO(inode)->read_setup(data, &msg); 339 NFS_PROTO(inode)->read_setup(data, &msg);
338 rpc_init_task(&data->task, &task_setup_data);
339 340
340 rpc_execute(&data->task); 341 task = rpc_run_task(&task_setup_data);
342 if (!IS_ERR(task))
343 rpc_put_task(task);
341 344
342 dprintk("NFS: %5u initiated direct read call " 345 dprintk("NFS: %5u initiated direct read call "
343 "(req %s/%Ld, %zu bytes @ offset %Lu)\n", 346 "(req %s/%Ld, %zu bytes @ offset %Lu)\n",
@@ -440,6 +443,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
440 struct inode *inode = dreq->inode; 443 struct inode *inode = dreq->inode;
441 struct list_head *p; 444 struct list_head *p;
442 struct nfs_write_data *data; 445 struct nfs_write_data *data;
446 struct rpc_task *task;
443 struct rpc_message msg = { 447 struct rpc_message msg = {
444 .rpc_cred = dreq->ctx->cred, 448 .rpc_cred = dreq->ctx->cred,
445 }; 449 };
@@ -471,16 +475,18 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
471 * Reuse data->task; data->args should not have changed 475 * Reuse data->task; data->args should not have changed
472 * since the original request was sent. 476 * since the original request was sent.
473 */ 477 */
478 task_setup_data.task = &data->task;
474 task_setup_data.callback_data = data; 479 task_setup_data.callback_data = data;
475 msg.rpc_argp = &data->args; 480 msg.rpc_argp = &data->args;
476 msg.rpc_resp = &data->res; 481 msg.rpc_resp = &data->res;
477 NFS_PROTO(inode)->write_setup(data, &msg); 482 NFS_PROTO(inode)->write_setup(data, &msg);
478 rpc_init_task(&data->task, &task_setup_data);
479 483
480 /* 484 /*
481 * We're called via an RPC callback, so BKL is already held. 485 * We're called via an RPC callback, so BKL is already held.
482 */ 486 */
483 rpc_execute(&data->task); 487 task = rpc_run_task(&task_setup_data);
488 if (!IS_ERR(task))
489 rpc_put_task(task);
484 490
485 dprintk("NFS: %5u rescheduled direct write call (req %s/%Ld, %u bytes @ offset %Lu)\n", 491 dprintk("NFS: %5u rescheduled direct write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
486 data->task.tk_pid, 492 data->task.tk_pid,
@@ -523,12 +529,14 @@ static const struct rpc_call_ops nfs_commit_direct_ops = {
523static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) 529static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
524{ 530{
525 struct nfs_write_data *data = dreq->commit_data; 531 struct nfs_write_data *data = dreq->commit_data;
532 struct rpc_task *task;
526 struct rpc_message msg = { 533 struct rpc_message msg = {
527 .rpc_argp = &data->args, 534 .rpc_argp = &data->args,
528 .rpc_resp = &data->res, 535 .rpc_resp = &data->res,
529 .rpc_cred = dreq->ctx->cred, 536 .rpc_cred = dreq->ctx->cred,
530 }; 537 };
531 struct rpc_task_setup task_setup_data = { 538 struct rpc_task_setup task_setup_data = {
539 .task = &data->task,
532 .rpc_client = NFS_CLIENT(dreq->inode), 540 .rpc_client = NFS_CLIENT(dreq->inode),
533 .rpc_message = &msg, 541 .rpc_message = &msg,
534 .callback_ops = &nfs_commit_direct_ops, 542 .callback_ops = &nfs_commit_direct_ops,
@@ -547,14 +555,15 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
547 data->res.verf = &data->verf; 555 data->res.verf = &data->verf;
548 556
549 NFS_PROTO(data->inode)->commit_setup(data, &msg); 557 NFS_PROTO(data->inode)->commit_setup(data, &msg);
550 rpc_init_task(&data->task, &task_setup_data);
551 558
552 /* Note: task.tk_ops->rpc_release will free dreq->commit_data */ 559 /* Note: task.tk_ops->rpc_release will free dreq->commit_data */
553 dreq->commit_data = NULL; 560 dreq->commit_data = NULL;
554 561
555 dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); 562 dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
556 563
557 rpc_execute(&data->task); 564 task = rpc_run_task(&task_setup_data);
565 if (!IS_ERR(task))
566 rpc_put_task(task);
558} 567}
559 568
560static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) 569static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
@@ -669,6 +678,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
669 struct inode *inode = ctx->path.dentry->d_inode; 678 struct inode *inode = ctx->path.dentry->d_inode;
670 unsigned long user_addr = (unsigned long)iov->iov_base; 679 unsigned long user_addr = (unsigned long)iov->iov_base;
671 size_t count = iov->iov_len; 680 size_t count = iov->iov_len;
681 struct rpc_task *task;
672 struct rpc_message msg = { 682 struct rpc_message msg = {
673 .rpc_cred = ctx->cred, 683 .rpc_cred = ctx->cred,
674 }; 684 };
@@ -732,13 +742,15 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
732 data->res.count = bytes; 742 data->res.count = bytes;
733 data->res.verf = &data->verf; 743 data->res.verf = &data->verf;
734 744
745 task_setup_data.task = &data->task;
735 task_setup_data.callback_data = data; 746 task_setup_data.callback_data = data;
736 msg.rpc_argp = &data->args; 747 msg.rpc_argp = &data->args;
737 msg.rpc_resp = &data->res; 748 msg.rpc_resp = &data->res;
738 NFS_PROTO(inode)->write_setup(data, &msg); 749 NFS_PROTO(inode)->write_setup(data, &msg);
739 rpc_init_task(&data->task, &task_setup_data);
740 750
741 rpc_execute(&data->task); 751 task = rpc_run_task(&task_setup_data);
752 if (!IS_ERR(task))
753 rpc_put_task(task);
742 754
743 dprintk("NFS: %5u initiated direct write call " 755 dprintk("NFS: %5u initiated direct write call "
744 "(req %s/%Ld, %zu bytes @ offset %Lu)\n", 756 "(req %s/%Ld, %zu bytes @ offset %Lu)\n",