diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-25 18:42:54 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:39 -0500 |
commit | 0773769191d943358a8392fa86abd756d004c4b6 (patch) | |
tree | 2eeba848f7c1e6ba90696190f05db26c2f31655e /fs/nfs | |
parent | e8f5d77c8029ff8f5dcd1dfc133aac0bbbffd92b (diff) |
NFS/SUNRPC: Convert users of rpc_init_task+rpc_execute to rpc_run_task()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/direct.c | 28 | ||||
-rw-r--r-- | fs/nfs/read.c | 17 | ||||
-rw-r--r-- | fs/nfs/write.c | 24 |
3 files changed, 35 insertions, 34 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 = { | |||
523 | static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) | 529 | static 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 | ||
560 | static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) | 569 | static 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", |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index e9dbdc8eafe6..efc121c494fe 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -153,16 +153,6 @@ static void nfs_readpage_release(struct nfs_page *req) | |||
153 | nfs_release_request(req); | 153 | nfs_release_request(req); |
154 | } | 154 | } |
155 | 155 | ||
156 | static void nfs_execute_read(struct nfs_read_data *data) | ||
157 | { | ||
158 | struct rpc_clnt *clnt = NFS_CLIENT(data->inode); | ||
159 | sigset_t oldset; | ||
160 | |||
161 | rpc_clnt_sigmask(clnt, &oldset); | ||
162 | rpc_execute(&data->task); | ||
163 | rpc_clnt_sigunmask(clnt, &oldset); | ||
164 | } | ||
165 | |||
166 | /* | 156 | /* |
167 | * Set up the NFS read request struct | 157 | * Set up the NFS read request struct |
168 | */ | 158 | */ |
@@ -172,12 +162,14 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, | |||
172 | { | 162 | { |
173 | struct inode *inode = req->wb_context->path.dentry->d_inode; | 163 | struct inode *inode = req->wb_context->path.dentry->d_inode; |
174 | int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; | 164 | int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; |
165 | struct rpc_task *task; | ||
175 | struct rpc_message msg = { | 166 | struct rpc_message msg = { |
176 | .rpc_argp = &data->args, | 167 | .rpc_argp = &data->args, |
177 | .rpc_resp = &data->res, | 168 | .rpc_resp = &data->res, |
178 | .rpc_cred = req->wb_context->cred, | 169 | .rpc_cred = req->wb_context->cred, |
179 | }; | 170 | }; |
180 | struct rpc_task_setup task_setup_data = { | 171 | struct rpc_task_setup task_setup_data = { |
172 | .task = &data->task, | ||
181 | .rpc_client = NFS_CLIENT(inode), | 173 | .rpc_client = NFS_CLIENT(inode), |
182 | .rpc_message = &msg, | 174 | .rpc_message = &msg, |
183 | .callback_ops = call_ops, | 175 | .callback_ops = call_ops, |
@@ -203,7 +195,6 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, | |||
203 | 195 | ||
204 | /* Set up the initial task struct. */ | 196 | /* Set up the initial task struct. */ |
205 | NFS_PROTO(inode)->read_setup(data, &msg); | 197 | NFS_PROTO(inode)->read_setup(data, &msg); |
206 | rpc_init_task(&data->task, &task_setup_data); | ||
207 | 198 | ||
208 | dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n", | 199 | dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n", |
209 | data->task.tk_pid, | 200 | data->task.tk_pid, |
@@ -212,7 +203,9 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, | |||
212 | count, | 203 | count, |
213 | (unsigned long long)data->args.offset); | 204 | (unsigned long long)data->args.offset); |
214 | 205 | ||
215 | nfs_execute_read(data); | 206 | task = rpc_run_task(&task_setup_data); |
207 | if (!IS_ERR(task)) | ||
208 | rpc_put_task(task); | ||
216 | } | 209 | } |
217 | 210 | ||
218 | static void | 211 | static void |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 9a69469274ae..fbd64f2fa7f9 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -764,16 +764,6 @@ static int flush_task_priority(int how) | |||
764 | return RPC_PRIORITY_NORMAL; | 764 | return RPC_PRIORITY_NORMAL; |
765 | } | 765 | } |
766 | 766 | ||
767 | static void nfs_execute_write(struct nfs_write_data *data) | ||
768 | { | ||
769 | struct rpc_clnt *clnt = NFS_CLIENT(data->inode); | ||
770 | sigset_t oldset; | ||
771 | |||
772 | rpc_clnt_sigmask(clnt, &oldset); | ||
773 | rpc_execute(&data->task); | ||
774 | rpc_clnt_sigunmask(clnt, &oldset); | ||
775 | } | ||
776 | |||
777 | /* | 767 | /* |
778 | * Set up the argument/result storage required for the RPC call. | 768 | * Set up the argument/result storage required for the RPC call. |
779 | */ | 769 | */ |
@@ -786,6 +776,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
786 | struct inode *inode = req->wb_context->path.dentry->d_inode; | 776 | struct inode *inode = req->wb_context->path.dentry->d_inode; |
787 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 777 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
788 | int priority = flush_task_priority(how); | 778 | int priority = flush_task_priority(how); |
779 | struct rpc_task *task; | ||
789 | struct rpc_message msg = { | 780 | struct rpc_message msg = { |
790 | .rpc_argp = &data->args, | 781 | .rpc_argp = &data->args, |
791 | .rpc_resp = &data->res, | 782 | .rpc_resp = &data->res, |
@@ -793,6 +784,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
793 | }; | 784 | }; |
794 | struct rpc_task_setup task_setup_data = { | 785 | struct rpc_task_setup task_setup_data = { |
795 | .rpc_client = NFS_CLIENT(inode), | 786 | .rpc_client = NFS_CLIENT(inode), |
787 | .task = &data->task, | ||
796 | .rpc_message = &msg, | 788 | .rpc_message = &msg, |
797 | .callback_ops = call_ops, | 789 | .callback_ops = call_ops, |
798 | .callback_data = data, | 790 | .callback_data = data, |
@@ -827,7 +819,6 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
827 | 819 | ||
828 | /* Set up the initial task struct. */ | 820 | /* Set up the initial task struct. */ |
829 | NFS_PROTO(inode)->write_setup(data, &msg); | 821 | NFS_PROTO(inode)->write_setup(data, &msg); |
830 | rpc_init_task(&data->task, &task_setup_data); | ||
831 | 822 | ||
832 | dprintk("NFS: %5u initiated write call " | 823 | dprintk("NFS: %5u initiated write call " |
833 | "(req %s/%Ld, %u bytes @ offset %Lu)\n", | 824 | "(req %s/%Ld, %u bytes @ offset %Lu)\n", |
@@ -837,7 +828,9 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
837 | count, | 828 | count, |
838 | (unsigned long long)data->args.offset); | 829 | (unsigned long long)data->args.offset); |
839 | 830 | ||
840 | nfs_execute_write(data); | 831 | task = rpc_run_task(&task_setup_data); |
832 | if (!IS_ERR(task)) | ||
833 | rpc_put_task(task); | ||
841 | } | 834 | } |
842 | 835 | ||
843 | /* | 836 | /* |
@@ -1164,12 +1157,14 @@ static void nfs_commit_rpcsetup(struct list_head *head, | |||
1164 | struct inode *inode = first->wb_context->path.dentry->d_inode; | 1157 | struct inode *inode = first->wb_context->path.dentry->d_inode; |
1165 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 1158 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
1166 | int priority = flush_task_priority(how); | 1159 | int priority = flush_task_priority(how); |
1160 | struct rpc_task *task; | ||
1167 | struct rpc_message msg = { | 1161 | struct rpc_message msg = { |
1168 | .rpc_argp = &data->args, | 1162 | .rpc_argp = &data->args, |
1169 | .rpc_resp = &data->res, | 1163 | .rpc_resp = &data->res, |
1170 | .rpc_cred = first->wb_context->cred, | 1164 | .rpc_cred = first->wb_context->cred, |
1171 | }; | 1165 | }; |
1172 | struct rpc_task_setup task_setup_data = { | 1166 | struct rpc_task_setup task_setup_data = { |
1167 | .task = &data->task, | ||
1173 | .rpc_client = NFS_CLIENT(inode), | 1168 | .rpc_client = NFS_CLIENT(inode), |
1174 | .rpc_message = &msg, | 1169 | .rpc_message = &msg, |
1175 | .callback_ops = &nfs_commit_ops, | 1170 | .callback_ops = &nfs_commit_ops, |
@@ -1197,11 +1192,12 @@ static void nfs_commit_rpcsetup(struct list_head *head, | |||
1197 | 1192 | ||
1198 | /* Set up the initial task struct. */ | 1193 | /* Set up the initial task struct. */ |
1199 | NFS_PROTO(inode)->commit_setup(data, &msg); | 1194 | NFS_PROTO(inode)->commit_setup(data, &msg); |
1200 | rpc_init_task(&data->task, &task_setup_data); | ||
1201 | 1195 | ||
1202 | dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); | 1196 | dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); |
1203 | 1197 | ||
1204 | nfs_execute_write(data); | 1198 | task = rpc_run_task(&task_setup_data); |
1199 | if (!IS_ERR(task)) | ||
1200 | rpc_put_task(task); | ||
1205 | } | 1201 | } |
1206 | 1202 | ||
1207 | /* | 1203 | /* |