diff options
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 70 |
1 files changed, 46 insertions, 24 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 92c870d19ccd..ed67567f0556 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -68,27 +68,39 @@ nfs3_async_handle_jukebox(struct rpc_task *task) | |||
68 | return 1; | 68 | return 1; |
69 | } | 69 | } |
70 | 70 | ||
71 | /* | ||
72 | * Bare-bones access to getattr: this is for nfs_read_super. | ||
73 | */ | ||
74 | static int | 71 | static int |
75 | nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | 72 | do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle, |
76 | struct nfs_fsinfo *info) | 73 | struct nfs_fsinfo *info) |
77 | { | 74 | { |
78 | int status; | 75 | int status; |
79 | 76 | ||
80 | dprintk("%s: call fsinfo\n", __FUNCTION__); | 77 | dprintk("%s: call fsinfo\n", __FUNCTION__); |
81 | nfs_fattr_init(info->fattr); | 78 | nfs_fattr_init(info->fattr); |
82 | status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); | 79 | status = rpc_call(client, NFS3PROC_FSINFO, fhandle, info, 0); |
83 | dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); | 80 | dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); |
84 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { | 81 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { |
85 | status = rpc_call(server->client_sys, NFS3PROC_GETATTR, fhandle, info->fattr, 0); | 82 | status = rpc_call(client, NFS3PROC_GETATTR, fhandle, info->fattr, 0); |
86 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); | 83 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); |
87 | } | 84 | } |
88 | return status; | 85 | return status; |
89 | } | 86 | } |
90 | 87 | ||
91 | /* | 88 | /* |
89 | * Bare-bones access to getattr: this is for nfs_read_super. | ||
90 | */ | ||
91 | static int | ||
92 | nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | ||
93 | struct nfs_fsinfo *info) | ||
94 | { | ||
95 | int status; | ||
96 | |||
97 | status = do_proc_get_root(server->client, fhandle, info); | ||
98 | if (status && server->client_sys != server->client) | ||
99 | status = do_proc_get_root(server->client_sys, fhandle, info); | ||
100 | return status; | ||
101 | } | ||
102 | |||
103 | /* | ||
92 | * One function for each procedure in the NFS protocol. | 104 | * One function for each procedure in the NFS protocol. |
93 | */ | 105 | */ |
94 | static int | 106 | static int |
@@ -732,19 +744,23 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
732 | 744 | ||
733 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 745 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); |
734 | 746 | ||
735 | static void | 747 | static void nfs3_read_done(struct rpc_task *task, void *calldata) |
736 | nfs3_read_done(struct rpc_task *task) | ||
737 | { | 748 | { |
738 | struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; | 749 | struct nfs_read_data *data = calldata; |
739 | 750 | ||
740 | if (nfs3_async_handle_jukebox(task)) | 751 | if (nfs3_async_handle_jukebox(task)) |
741 | return; | 752 | return; |
742 | /* Call back common NFS readpage processing */ | 753 | /* Call back common NFS readpage processing */ |
743 | if (task->tk_status >= 0) | 754 | if (task->tk_status >= 0) |
744 | nfs_refresh_inode(data->inode, &data->fattr); | 755 | nfs_refresh_inode(data->inode, &data->fattr); |
745 | nfs_readpage_result(task); | 756 | nfs_readpage_result(task, calldata); |
746 | } | 757 | } |
747 | 758 | ||
759 | static const struct rpc_call_ops nfs3_read_ops = { | ||
760 | .rpc_call_done = nfs3_read_done, | ||
761 | .rpc_release = nfs_readdata_release, | ||
762 | }; | ||
763 | |||
748 | static void | 764 | static void |
749 | nfs3_proc_read_setup(struct nfs_read_data *data) | 765 | nfs3_proc_read_setup(struct nfs_read_data *data) |
750 | { | 766 | { |
@@ -762,23 +778,26 @@ nfs3_proc_read_setup(struct nfs_read_data *data) | |||
762 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | 778 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); |
763 | 779 | ||
764 | /* Finalize the task. */ | 780 | /* Finalize the task. */ |
765 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_read_done, flags); | 781 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_read_ops, data); |
766 | rpc_call_setup(task, &msg, 0); | 782 | rpc_call_setup(task, &msg, 0); |
767 | } | 783 | } |
768 | 784 | ||
769 | static void | 785 | static void nfs3_write_done(struct rpc_task *task, void *calldata) |
770 | nfs3_write_done(struct rpc_task *task) | ||
771 | { | 786 | { |
772 | struct nfs_write_data *data; | 787 | struct nfs_write_data *data = calldata; |
773 | 788 | ||
774 | if (nfs3_async_handle_jukebox(task)) | 789 | if (nfs3_async_handle_jukebox(task)) |
775 | return; | 790 | return; |
776 | data = (struct nfs_write_data *)task->tk_calldata; | ||
777 | if (task->tk_status >= 0) | 791 | if (task->tk_status >= 0) |
778 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 792 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
779 | nfs_writeback_done(task); | 793 | nfs_writeback_done(task, calldata); |
780 | } | 794 | } |
781 | 795 | ||
796 | static const struct rpc_call_ops nfs3_write_ops = { | ||
797 | .rpc_call_done = nfs3_write_done, | ||
798 | .rpc_release = nfs_writedata_release, | ||
799 | }; | ||
800 | |||
782 | static void | 801 | static void |
783 | nfs3_proc_write_setup(struct nfs_write_data *data, int how) | 802 | nfs3_proc_write_setup(struct nfs_write_data *data, int how) |
784 | { | 803 | { |
@@ -806,23 +825,26 @@ nfs3_proc_write_setup(struct nfs_write_data *data, int how) | |||
806 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 825 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
807 | 826 | ||
808 | /* Finalize the task. */ | 827 | /* Finalize the task. */ |
809 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_write_done, flags); | 828 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_write_ops, data); |
810 | rpc_call_setup(task, &msg, 0); | 829 | rpc_call_setup(task, &msg, 0); |
811 | } | 830 | } |
812 | 831 | ||
813 | static void | 832 | static void nfs3_commit_done(struct rpc_task *task, void *calldata) |
814 | nfs3_commit_done(struct rpc_task *task) | ||
815 | { | 833 | { |
816 | struct nfs_write_data *data; | 834 | struct nfs_write_data *data = calldata; |
817 | 835 | ||
818 | if (nfs3_async_handle_jukebox(task)) | 836 | if (nfs3_async_handle_jukebox(task)) |
819 | return; | 837 | return; |
820 | data = (struct nfs_write_data *)task->tk_calldata; | ||
821 | if (task->tk_status >= 0) | 838 | if (task->tk_status >= 0) |
822 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 839 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
823 | nfs_commit_done(task); | 840 | nfs_commit_done(task, calldata); |
824 | } | 841 | } |
825 | 842 | ||
843 | static const struct rpc_call_ops nfs3_commit_ops = { | ||
844 | .rpc_call_done = nfs3_commit_done, | ||
845 | .rpc_release = nfs_commit_release, | ||
846 | }; | ||
847 | |||
826 | static void | 848 | static void |
827 | nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | 849 | nfs3_proc_commit_setup(struct nfs_write_data *data, int how) |
828 | { | 850 | { |
@@ -840,7 +862,7 @@ nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | |||
840 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 862 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
841 | 863 | ||
842 | /* Finalize the task. */ | 864 | /* Finalize the task. */ |
843 | rpc_init_task(task, NFS_CLIENT(inode), nfs3_commit_done, flags); | 865 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_commit_ops, data); |
844 | rpc_call_setup(task, &msg, 0); | 866 | rpc_call_setup(task, &msg, 0); |
845 | } | 867 | } |
846 | 868 | ||