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/nfs3proc.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/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 92c870d19ccd..c172a7584646 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -732,19 +732,23 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
732 | 732 | ||
733 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 733 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); |
734 | 734 | ||
735 | static void | 735 | static void nfs3_read_done(struct rpc_task *task, void *calldata) |
736 | nfs3_read_done(struct rpc_task *task) | ||
737 | { | 736 | { |
738 | struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; | 737 | struct nfs_read_data *data = calldata; |
739 | 738 | ||
740 | if (nfs3_async_handle_jukebox(task)) | 739 | if (nfs3_async_handle_jukebox(task)) |
741 | return; | 740 | return; |
742 | /* Call back common NFS readpage processing */ | 741 | /* Call back common NFS readpage processing */ |
743 | if (task->tk_status >= 0) | 742 | if (task->tk_status >= 0) |
744 | nfs_refresh_inode(data->inode, &data->fattr); | 743 | nfs_refresh_inode(data->inode, &data->fattr); |
745 | nfs_readpage_result(task); | 744 | nfs_readpage_result(task, calldata); |
746 | } | 745 | } |
747 | 746 | ||
747 | static const struct rpc_call_ops nfs3_read_ops = { | ||
748 | .rpc_call_done = nfs3_read_done, | ||
749 | .rpc_release = nfs_readdata_release, | ||
750 | }; | ||
751 | |||
748 | static void | 752 | static void |
749 | nfs3_proc_read_setup(struct nfs_read_data *data) | 753 | nfs3_proc_read_setup(struct nfs_read_data *data) |
750 | { | 754 | { |
@@ -762,23 +766,26 @@ nfs3_proc_read_setup(struct nfs_read_data *data) | |||
762 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | 766 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); |
763 | 767 | ||
764 | /* Finalize the task. */ | 768 | /* Finalize the task. */ |
765 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_read_done, flags); | 769 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_read_ops, data); |
766 | rpc_call_setup(task, &msg, 0); | 770 | rpc_call_setup(task, &msg, 0); |
767 | } | 771 | } |
768 | 772 | ||
769 | static void | 773 | static void nfs3_write_done(struct rpc_task *task, void *calldata) |
770 | nfs3_write_done(struct rpc_task *task) | ||
771 | { | 774 | { |
772 | struct nfs_write_data *data; | 775 | struct nfs_write_data *data = calldata; |
773 | 776 | ||
774 | if (nfs3_async_handle_jukebox(task)) | 777 | if (nfs3_async_handle_jukebox(task)) |
775 | return; | 778 | return; |
776 | data = (struct nfs_write_data *)task->tk_calldata; | ||
777 | if (task->tk_status >= 0) | 779 | if (task->tk_status >= 0) |
778 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 780 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
779 | nfs_writeback_done(task); | 781 | nfs_writeback_done(task, calldata); |
780 | } | 782 | } |
781 | 783 | ||
784 | static const struct rpc_call_ops nfs3_write_ops = { | ||
785 | .rpc_call_done = nfs3_write_done, | ||
786 | .rpc_release = nfs_writedata_release, | ||
787 | }; | ||
788 | |||
782 | static void | 789 | static void |
783 | nfs3_proc_write_setup(struct nfs_write_data *data, int how) | 790 | nfs3_proc_write_setup(struct nfs_write_data *data, int how) |
784 | { | 791 | { |
@@ -806,23 +813,26 @@ nfs3_proc_write_setup(struct nfs_write_data *data, int how) | |||
806 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 813 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
807 | 814 | ||
808 | /* Finalize the task. */ | 815 | /* Finalize the task. */ |
809 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_write_done, flags); | 816 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_write_ops, data); |
810 | rpc_call_setup(task, &msg, 0); | 817 | rpc_call_setup(task, &msg, 0); |
811 | } | 818 | } |
812 | 819 | ||
813 | static void | 820 | static void nfs3_commit_done(struct rpc_task *task, void *calldata) |
814 | nfs3_commit_done(struct rpc_task *task) | ||
815 | { | 821 | { |
816 | struct nfs_write_data *data; | 822 | struct nfs_write_data *data = calldata; |
817 | 823 | ||
818 | if (nfs3_async_handle_jukebox(task)) | 824 | if (nfs3_async_handle_jukebox(task)) |
819 | return; | 825 | return; |
820 | data = (struct nfs_write_data *)task->tk_calldata; | ||
821 | if (task->tk_status >= 0) | 826 | if (task->tk_status >= 0) |
822 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 827 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
823 | nfs_commit_done(task); | 828 | nfs_commit_done(task, calldata); |
824 | } | 829 | } |
825 | 830 | ||
831 | static const struct rpc_call_ops nfs3_commit_ops = { | ||
832 | .rpc_call_done = nfs3_commit_done, | ||
833 | .rpc_release = nfs_commit_release, | ||
834 | }; | ||
835 | |||
826 | static void | 836 | static void |
827 | nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | 837 | nfs3_proc_commit_setup(struct nfs_write_data *data, int how) |
828 | { | 838 | { |
@@ -840,7 +850,7 @@ nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | |||
840 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 850 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
841 | 851 | ||
842 | /* Finalize the task. */ | 852 | /* Finalize the task. */ |
843 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_commit_done, flags); | 853 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_commit_ops, data); |
844 | rpc_call_setup(task, &msg, 0); | 854 | rpc_call_setup(task, &msg, 0); |
845 | } | 855 | } |
846 | 856 | ||