diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:27 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:27 -0500 |
commit | ec06c096edec0755534c7126f4caded69de131c2 (patch) | |
tree | 1f5b219c09dea1d9886cefe3ea3f7cef560a5e9a /fs/nfs/nfs3proc.c | |
parent | 788e7a89a03e364855583c0ab4649b94925efbb9 (diff) |
NFS: Cleanup of NFS read code
Same callback hierarchy inversion as for the NFS write calls. This patch is
not strictly speaking needed by the O_DIRECT code, but avoids confusing
differences between the asynchronous read and write code.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index c4f7de8830e9..cf186f0d2b3b 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -811,29 +811,18 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
811 | 811 | ||
812 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 812 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); |
813 | 813 | ||
814 | static void nfs3_read_done(struct rpc_task *task, void *calldata) | 814 | static int nfs3_read_done(struct rpc_task *task, struct nfs_read_data *data) |
815 | { | 815 | { |
816 | struct nfs_read_data *data = calldata; | ||
817 | |||
818 | if (nfs3_async_handle_jukebox(task, data->inode)) | 816 | if (nfs3_async_handle_jukebox(task, data->inode)) |
819 | return; | 817 | return -EAGAIN; |
820 | /* Call back common NFS readpage processing */ | 818 | /* Call back common NFS readpage processing */ |
821 | if (task->tk_status >= 0) | 819 | if (task->tk_status >= 0) |
822 | nfs_refresh_inode(data->inode, &data->fattr); | 820 | nfs_refresh_inode(data->inode, &data->fattr); |
823 | nfs_readpage_result(task, calldata); | 821 | return 0; |
824 | } | 822 | } |
825 | 823 | ||
826 | static const struct rpc_call_ops nfs3_read_ops = { | 824 | static void nfs3_proc_read_setup(struct nfs_read_data *data) |
827 | .rpc_call_done = nfs3_read_done, | ||
828 | .rpc_release = nfs_readdata_release, | ||
829 | }; | ||
830 | |||
831 | static void | ||
832 | nfs3_proc_read_setup(struct nfs_read_data *data) | ||
833 | { | 825 | { |
834 | struct rpc_task *task = &data->task; | ||
835 | struct inode *inode = data->inode; | ||
836 | int flags; | ||
837 | struct rpc_message msg = { | 826 | struct rpc_message msg = { |
838 | .rpc_proc = &nfs3_procedures[NFS3PROC_READ], | 827 | .rpc_proc = &nfs3_procedures[NFS3PROC_READ], |
839 | .rpc_argp = &data->args, | 828 | .rpc_argp = &data->args, |
@@ -841,12 +830,7 @@ nfs3_proc_read_setup(struct nfs_read_data *data) | |||
841 | .rpc_cred = data->cred, | 830 | .rpc_cred = data->cred, |
842 | }; | 831 | }; |
843 | 832 | ||
844 | /* N.B. Do we need to test? Never called for swapfile inode */ | 833 | rpc_call_setup(&data->task, &msg, 0); |
845 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | ||
846 | |||
847 | /* Finalize the task. */ | ||
848 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_read_ops, data); | ||
849 | rpc_call_setup(task, &msg, 0); | ||
850 | } | 834 | } |
851 | 835 | ||
852 | static int nfs3_write_done(struct rpc_task *task, struct nfs_write_data *data) | 836 | static int nfs3_write_done(struct rpc_task *task, struct nfs_write_data *data) |
@@ -935,6 +919,7 @@ struct nfs_rpc_ops nfs_v3_clientops = { | |||
935 | .pathconf = nfs3_proc_pathconf, | 919 | .pathconf = nfs3_proc_pathconf, |
936 | .decode_dirent = nfs3_decode_dirent, | 920 | .decode_dirent = nfs3_decode_dirent, |
937 | .read_setup = nfs3_proc_read_setup, | 921 | .read_setup = nfs3_proc_read_setup, |
922 | .read_done = nfs3_read_done, | ||
938 | .write_setup = nfs3_proc_write_setup, | 923 | .write_setup = nfs3_proc_write_setup, |
939 | .write_done = nfs3_write_done, | 924 | .write_done = nfs3_write_done, |
940 | .commit_setup = nfs3_proc_commit_setup, | 925 | .commit_setup = nfs3_proc_commit_setup, |