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/nfs4proc.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/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ef4dc315ecc2..bad1eae5608a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2345,47 +2345,31 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2345 | return err; | 2345 | return err; |
2346 | } | 2346 | } |
2347 | 2347 | ||
2348 | static void nfs4_read_done(struct rpc_task *task, void *calldata) | 2348 | static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) |
2349 | { | 2349 | { |
2350 | struct nfs_read_data *data = calldata; | 2350 | struct nfs_server *server = NFS_SERVER(data->inode); |
2351 | struct inode *inode = data->inode; | ||
2352 | 2351 | ||
2353 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { | 2352 | if (nfs4_async_handle_error(task, server) == -EAGAIN) { |
2354 | rpc_restart_call(task); | 2353 | rpc_restart_call(task); |
2355 | return; | 2354 | return -EAGAIN; |
2356 | } | 2355 | } |
2357 | if (task->tk_status > 0) | 2356 | if (task->tk_status > 0) |
2358 | renew_lease(NFS_SERVER(inode), data->timestamp); | 2357 | renew_lease(server, data->timestamp); |
2359 | /* Call back common NFS readpage processing */ | 2358 | return 0; |
2360 | nfs_readpage_result(task, calldata); | ||
2361 | } | 2359 | } |
2362 | 2360 | ||
2363 | static const struct rpc_call_ops nfs4_read_ops = { | 2361 | static void nfs4_proc_read_setup(struct nfs_read_data *data) |
2364 | .rpc_call_done = nfs4_read_done, | ||
2365 | .rpc_release = nfs_readdata_release, | ||
2366 | }; | ||
2367 | |||
2368 | static void | ||
2369 | nfs4_proc_read_setup(struct nfs_read_data *data) | ||
2370 | { | 2362 | { |
2371 | struct rpc_task *task = &data->task; | ||
2372 | struct rpc_message msg = { | 2363 | struct rpc_message msg = { |
2373 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ], | 2364 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ], |
2374 | .rpc_argp = &data->args, | 2365 | .rpc_argp = &data->args, |
2375 | .rpc_resp = &data->res, | 2366 | .rpc_resp = &data->res, |
2376 | .rpc_cred = data->cred, | 2367 | .rpc_cred = data->cred, |
2377 | }; | 2368 | }; |
2378 | struct inode *inode = data->inode; | ||
2379 | int flags; | ||
2380 | 2369 | ||
2381 | data->timestamp = jiffies; | 2370 | data->timestamp = jiffies; |
2382 | 2371 | ||
2383 | /* N.B. Do we need to test? Never called for swapfile inode */ | 2372 | rpc_call_setup(&data->task, &msg, 0); |
2384 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | ||
2385 | |||
2386 | /* Finalize the task. */ | ||
2387 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_read_ops, data); | ||
2388 | rpc_call_setup(task, &msg, 0); | ||
2389 | } | 2373 | } |
2390 | 2374 | ||
2391 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) | 2375 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) |
@@ -3617,6 +3601,7 @@ struct nfs_rpc_ops nfs_v4_clientops = { | |||
3617 | .pathconf = nfs4_proc_pathconf, | 3601 | .pathconf = nfs4_proc_pathconf, |
3618 | .decode_dirent = nfs4_decode_dirent, | 3602 | .decode_dirent = nfs4_decode_dirent, |
3619 | .read_setup = nfs4_proc_read_setup, | 3603 | .read_setup = nfs4_proc_read_setup, |
3604 | .read_done = nfs4_read_done, | ||
3620 | .write_setup = nfs4_proc_write_setup, | 3605 | .write_setup = nfs4_proc_write_setup, |
3621 | .write_done = nfs4_write_done, | 3606 | .write_done = nfs4_write_done, |
3622 | .commit_setup = nfs4_proc_commit_setup, | 3607 | .commit_setup = nfs4_proc_commit_setup, |