diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:04 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:39 -0500 |
commit | 963d8fe53339128ee46a7701f2e36305f0ccff8c (patch) | |
tree | 426736c70a8e05cb1d945d5c7f44ea6475edd113 /fs/nfs/proc.c | |
parent | abbcf28f23d53e8ec56a91f3528743913fa2694a (diff) |
RPC: Clean up RPC task structure
Shrink the RPC task structure. Instead of storing separate pointers
for task->tk_exit and task->tk_release, put them in a structure.
Also pass the user data pointer as a parameter instead of passing it via
task->tk_calldata. This enables us to nest callbacks.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r-- | fs/nfs/proc.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index e1e3ca5d746b..6145e82b45e8 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -547,10 +547,9 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
547 | 547 | ||
548 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); | 548 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); |
549 | 549 | ||
550 | static void | 550 | static void nfs_read_done(struct rpc_task *task, void *calldata) |
551 | nfs_read_done(struct rpc_task *task) | ||
552 | { | 551 | { |
553 | struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; | 552 | struct nfs_read_data *data = calldata; |
554 | 553 | ||
555 | if (task->tk_status >= 0) { | 554 | if (task->tk_status >= 0) { |
556 | nfs_refresh_inode(data->inode, data->res.fattr); | 555 | nfs_refresh_inode(data->inode, data->res.fattr); |
@@ -560,9 +559,14 @@ nfs_read_done(struct rpc_task *task) | |||
560 | if (data->args.offset + data->args.count >= data->res.fattr->size) | 559 | if (data->args.offset + data->args.count >= data->res.fattr->size) |
561 | data->res.eof = 1; | 560 | data->res.eof = 1; |
562 | } | 561 | } |
563 | nfs_readpage_result(task); | 562 | nfs_readpage_result(task, calldata); |
564 | } | 563 | } |
565 | 564 | ||
565 | static const struct rpc_call_ops nfs_read_ops = { | ||
566 | .rpc_call_done = nfs_read_done, | ||
567 | .rpc_release = nfs_readdata_release, | ||
568 | }; | ||
569 | |||
566 | static void | 570 | static void |
567 | nfs_proc_read_setup(struct nfs_read_data *data) | 571 | nfs_proc_read_setup(struct nfs_read_data *data) |
568 | { | 572 | { |
@@ -580,20 +584,24 @@ nfs_proc_read_setup(struct nfs_read_data *data) | |||
580 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | 584 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); |
581 | 585 | ||
582 | /* Finalize the task. */ | 586 | /* Finalize the task. */ |
583 | rpc_init_task(task, NFS_CLIENT(inode), nfs_read_done, flags); | 587 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_read_ops, data); |
584 | rpc_call_setup(task, &msg, 0); | 588 | rpc_call_setup(task, &msg, 0); |
585 | } | 589 | } |
586 | 590 | ||
587 | static void | 591 | static void nfs_write_done(struct rpc_task *task, void *calldata) |
588 | nfs_write_done(struct rpc_task *task) | ||
589 | { | 592 | { |
590 | struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; | 593 | struct nfs_write_data *data = calldata; |
591 | 594 | ||
592 | if (task->tk_status >= 0) | 595 | if (task->tk_status >= 0) |
593 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 596 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
594 | nfs_writeback_done(task); | 597 | nfs_writeback_done(task, calldata); |
595 | } | 598 | } |
596 | 599 | ||
600 | static const struct rpc_call_ops nfs_write_ops = { | ||
601 | .rpc_call_done = nfs_write_done, | ||
602 | .rpc_release = nfs_writedata_release, | ||
603 | }; | ||
604 | |||
597 | static void | 605 | static void |
598 | nfs_proc_write_setup(struct nfs_write_data *data, int how) | 606 | nfs_proc_write_setup(struct nfs_write_data *data, int how) |
599 | { | 607 | { |
@@ -614,7 +622,7 @@ nfs_proc_write_setup(struct nfs_write_data *data, int how) | |||
614 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 622 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
615 | 623 | ||
616 | /* Finalize the task. */ | 624 | /* Finalize the task. */ |
617 | rpc_init_task(task, NFS_CLIENT(inode), nfs_write_done, flags); | 625 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_write_ops, data); |
618 | rpc_call_setup(task, &msg, 0); | 626 | rpc_call_setup(task, &msg, 0); |
619 | } | 627 | } |
620 | 628 | ||