aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:27 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:27 -0500
commitec06c096edec0755534c7126f4caded69de131c2 (patch)
tree1f5b219c09dea1d9886cefe3ea3f7cef560a5e9a /fs/nfs/proc.c
parent788e7a89a03e364855583c0ab4649b94925efbb9 (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/proc.c')
-rw-r--r--fs/nfs/proc.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 608aa5932a1d..9dd85cac2df0 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -613,10 +613,8 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
613 613
614extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); 614extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
615 615
616static void nfs_read_done(struct rpc_task *task, void *calldata) 616static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
617{ 617{
618 struct nfs_read_data *data = calldata;
619
620 if (task->tk_status >= 0) { 618 if (task->tk_status >= 0) {
621 nfs_refresh_inode(data->inode, data->res.fattr); 619 nfs_refresh_inode(data->inode, data->res.fattr);
622 /* Emulate the eof flag, which isn't normally needed in NFSv2 620 /* Emulate the eof flag, which isn't normally needed in NFSv2
@@ -625,20 +623,11 @@ static void nfs_read_done(struct rpc_task *task, void *calldata)
625 if (data->args.offset + data->args.count >= data->res.fattr->size) 623 if (data->args.offset + data->args.count >= data->res.fattr->size)
626 data->res.eof = 1; 624 data->res.eof = 1;
627 } 625 }
628 nfs_readpage_result(task, calldata); 626 return 0;
629} 627}
630 628
631static const struct rpc_call_ops nfs_read_ops = { 629static void nfs_proc_read_setup(struct nfs_read_data *data)
632 .rpc_call_done = nfs_read_done,
633 .rpc_release = nfs_readdata_release,
634};
635
636static void
637nfs_proc_read_setup(struct nfs_read_data *data)
638{ 630{
639 struct rpc_task *task = &data->task;
640 struct inode *inode = data->inode;
641 int flags;
642 struct rpc_message msg = { 631 struct rpc_message msg = {
643 .rpc_proc = &nfs_procedures[NFSPROC_READ], 632 .rpc_proc = &nfs_procedures[NFSPROC_READ],
644 .rpc_argp = &data->args, 633 .rpc_argp = &data->args,
@@ -646,12 +635,7 @@ nfs_proc_read_setup(struct nfs_read_data *data)
646 .rpc_cred = data->cred, 635 .rpc_cred = data->cred,
647 }; 636 };
648 637
649 /* N.B. Do we need to test? Never called for swapfile inode */ 638 rpc_call_setup(&data->task, &msg, 0);
650 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
651
652 /* Finalize the task. */
653 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_read_ops, data);
654 rpc_call_setup(task, &msg, 0);
655} 639}
656 640
657static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data) 641static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data)
@@ -720,6 +704,7 @@ struct nfs_rpc_ops nfs_v2_clientops = {
720 .pathconf = nfs_proc_pathconf, 704 .pathconf = nfs_proc_pathconf,
721 .decode_dirent = nfs_decode_dirent, 705 .decode_dirent = nfs_decode_dirent,
722 .read_setup = nfs_proc_read_setup, 706 .read_setup = nfs_proc_read_setup,
707 .read_done = nfs_read_done,
723 .write_setup = nfs_proc_write_setup, 708 .write_setup = nfs_proc_write_setup,
724 .write_done = nfs_write_done, 709 .write_done = nfs_write_done,
725 .commit_setup = nfs_proc_commit_setup, 710 .commit_setup = nfs_proc_commit_setup,