diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-01 09:22:25 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 13:46:48 -0400 |
commit | f11c88af26453aee2823a1fd9120d0cd8dae7b9a (patch) | |
tree | 2a914fad3197bb9c28477e7a6224489acc11ae5d /fs | |
parent | 472cfbd9b97be210a9b61ac1c6a774cd456ea9d2 (diff) |
nfs41: read sequence setup/done support
Implement the read rpc_call_prepare method for
asynchronuos nfs rpcs, call nfs41_setup_sequence from
respective rpc_call_validate_args methods.
Call nfs4_sequence_done from respective rpc_call_done methods.
Note that we need to pass a pointer to the nfs_server in calls data
for passing on to nfs4_sequence_done.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[pnfs: client data server write validate and release]
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[move the nfs4_sequence_free_slot call in nfs_readpage_retry from]
[nfs41: separate free slot from sequence done]
[remove nfs_readargs.nfs_server, use calldata->inode instead]
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: Support sessions with O_DIRECT]
Signed-off-by: Dean Hildebrand <dhildeb@us.ibm.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: nfs4_sequence_free_slot use nfs_client for data server]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/direct.c | 3 | ||||
-rw-r--r-- | fs/nfs/internal.h | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 5 | ||||
-rw-r--r-- | fs/nfs/read.c | 30 |
4 files changed, 39 insertions, 2 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 08f6b040d289..c8c53a03a585 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -259,6 +259,9 @@ static void nfs_direct_read_release(void *calldata) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | static const struct rpc_call_ops nfs_read_direct_ops = { | 261 | static const struct rpc_call_ops nfs_read_direct_ops = { |
262 | #if defined(CONFIG_NFS_V4_1) | ||
263 | .rpc_call_prepare = nfs_read_prepare, | ||
264 | #endif /* CONFIG_NFS_V4_1 */ | ||
262 | .rpc_call_done = nfs_direct_read_result, | 265 | .rpc_call_done = nfs_direct_read_result, |
263 | .rpc_release = nfs_direct_read_release, | 266 | .rpc_release = nfs_direct_read_release, |
264 | }; | 267 | }; |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 12f4c5e6fd39..988c8b9aa78b 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -206,6 +206,9 @@ extern int nfs4_path_walk(struct nfs_server *server, | |||
206 | const char *path); | 206 | const char *path); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | /* read.c */ | ||
210 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); | ||
211 | |||
209 | /* nfs4proc.c */ | 212 | /* nfs4proc.c */ |
210 | extern int _nfs4_call_sync(struct nfs_server *server, | 213 | extern int _nfs4_call_sync(struct nfs_server *server, |
211 | struct rpc_message *msg, | 214 | struct rpc_message *msg, |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 97521e47e437..6c0ac539d9c7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2864,6 +2864,11 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) | |||
2864 | { | 2864 | { |
2865 | struct nfs_server *server = NFS_SERVER(data->inode); | 2865 | struct nfs_server *server = NFS_SERVER(data->inode); |
2866 | 2866 | ||
2867 | dprintk("--> %s\n", __func__); | ||
2868 | |||
2869 | /* nfs4_sequence_free_slot called in the read rpc_call_done */ | ||
2870 | nfs4_sequence_done(server, &data->res.seq_res, task->tk_status); | ||
2871 | |||
2867 | if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { | 2872 | if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { |
2868 | rpc_restart_call(task); | 2873 | rpc_restart_call(task); |
2869 | return -EAGAIN; | 2874 | return -EAGAIN; |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 70ba2b4cb9a4..d71f0d55ebde 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <asm/system.h> | 23 | #include <asm/system.h> |
24 | 24 | ||
25 | #include "nfs4_fs.h" | ||
25 | #include "internal.h" | 26 | #include "internal.h" |
26 | #include "iostat.h" | 27 | #include "iostat.h" |
27 | #include "fscache.h" | 28 | #include "fscache.h" |
@@ -358,19 +359,25 @@ static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data | |||
358 | struct nfs_readres *resp = &data->res; | 359 | struct nfs_readres *resp = &data->res; |
359 | 360 | ||
360 | if (resp->eof || resp->count == argp->count) | 361 | if (resp->eof || resp->count == argp->count) |
361 | return; | 362 | goto out; |
362 | 363 | ||
363 | /* This is a short read! */ | 364 | /* This is a short read! */ |
364 | nfs_inc_stats(data->inode, NFSIOS_SHORTREAD); | 365 | nfs_inc_stats(data->inode, NFSIOS_SHORTREAD); |
365 | /* Has the server at least made some progress? */ | 366 | /* Has the server at least made some progress? */ |
366 | if (resp->count == 0) | 367 | if (resp->count == 0) |
367 | return; | 368 | goto out; |
368 | 369 | ||
369 | /* Yes, so retry the read at the end of the data */ | 370 | /* Yes, so retry the read at the end of the data */ |
370 | argp->offset += resp->count; | 371 | argp->offset += resp->count; |
371 | argp->pgbase += resp->count; | 372 | argp->pgbase += resp->count; |
372 | argp->count -= resp->count; | 373 | argp->count -= resp->count; |
373 | rpc_restart_call(task); | 374 | rpc_restart_call(task); |
375 | return; | ||
376 | out: | ||
377 | nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client, | ||
378 | &data->res.seq_res); | ||
379 | return; | ||
380 | |||
374 | } | 381 | } |
375 | 382 | ||
376 | /* | 383 | /* |
@@ -407,7 +414,23 @@ static void nfs_readpage_release_partial(void *calldata) | |||
407 | nfs_readdata_release(calldata); | 414 | nfs_readdata_release(calldata); |
408 | } | 415 | } |
409 | 416 | ||
417 | #if defined(CONFIG_NFS_V4_1) | ||
418 | void nfs_read_prepare(struct rpc_task *task, void *calldata) | ||
419 | { | ||
420 | struct nfs_read_data *data = calldata; | ||
421 | |||
422 | if (nfs4_setup_sequence(NFS_SERVER(data->inode)->nfs_client, | ||
423 | &data->args.seq_args, &data->res.seq_res, | ||
424 | 0, task)) | ||
425 | return; | ||
426 | rpc_call_start(task); | ||
427 | } | ||
428 | #endif /* CONFIG_NFS_V4_1 */ | ||
429 | |||
410 | static const struct rpc_call_ops nfs_read_partial_ops = { | 430 | static const struct rpc_call_ops nfs_read_partial_ops = { |
431 | #if defined(CONFIG_NFS_V4_1) | ||
432 | .rpc_call_prepare = nfs_read_prepare, | ||
433 | #endif /* CONFIG_NFS_V4_1 */ | ||
411 | .rpc_call_done = nfs_readpage_result_partial, | 434 | .rpc_call_done = nfs_readpage_result_partial, |
412 | .rpc_release = nfs_readpage_release_partial, | 435 | .rpc_release = nfs_readpage_release_partial, |
413 | }; | 436 | }; |
@@ -471,6 +494,9 @@ static void nfs_readpage_release_full(void *calldata) | |||
471 | } | 494 | } |
472 | 495 | ||
473 | static const struct rpc_call_ops nfs_read_full_ops = { | 496 | static const struct rpc_call_ops nfs_read_full_ops = { |
497 | #if defined(CONFIG_NFS_V4_1) | ||
498 | .rpc_call_prepare = nfs_read_prepare, | ||
499 | #endif /* CONFIG_NFS_V4_1 */ | ||
474 | .rpc_call_done = nfs_readpage_result_full, | 500 | .rpc_call_done = nfs_readpage_result_full, |
475 | .rpc_release = nfs_readpage_release_full, | 501 | .rpc_release = nfs_readpage_release_full, |
476 | }; | 502 | }; |