aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:39:59 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:30 -0500
commit84115e1cd4a3614c4e566d4cce31381dce3dbef9 (patch)
tree01b2de7163deb6b3a789811183d8b8c1329b900c /fs/nfs/direct.c
parente8914c65f7f8d4e8701b8e78a12b714872ea0402 (diff)
SUNRPC: Cleanup of rpc_task initialisation
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c36
1 files changed, 28 insertions, 8 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;