aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:25 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 13:46:48 -0400
commitf11c88af26453aee2823a1fd9120d0cd8dae7b9a (patch)
tree2a914fad3197bb9c28477e7a6224489acc11ae5d /fs/nfs/read.c
parent472cfbd9b97be210a9b61ac1c6a774cd456ea9d2 (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/nfs/read.c')
-rw-r--r--fs/nfs/read.c30
1 files changed, 28 insertions, 2 deletions
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;
376out:
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)
418void 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
410static const struct rpc_call_ops nfs_read_partial_ops = { 430static 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
473static const struct rpc_call_ops nfs_read_full_ops = { 496static 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};