diff options
author | Andy Adamson <andros@netapp.com> | 2011-06-13 18:22:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-07-12 13:40:28 -0400 |
commit | 7c24d9489fe57d67cb56c6bdad58d89806e7fd97 (patch) | |
tree | 4df86fc0437ac2ed2c90123060d4676422fbd95e /fs/nfs/nfs4filelayout.c | |
parent | 47cb498e9316314e7e681f417135589195ad78a7 (diff) |
NFSv4.1: File layout only supports whole file layouts
Ask for whole file layouts. Until support for layout segments is fully
supported in the file layout code, discard non-whole file layouts.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index d1ae5bfa6680..51c19093022e 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -427,6 +427,14 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo, | |||
427 | 427 | ||
428 | dprintk("--> %s\n", __func__); | 428 | dprintk("--> %s\n", __func__); |
429 | 429 | ||
430 | /* FIXME: remove this check when layout segment support is added */ | ||
431 | if (lgr->range.offset != 0 || | ||
432 | lgr->range.length != NFS4_MAX_UINT64) { | ||
433 | dprintk("%s Only whole file layouts supported. Use MDS i/o\n", | ||
434 | __func__); | ||
435 | goto out; | ||
436 | } | ||
437 | |||
430 | if (fl->pattern_offset > lgr->range.offset) { | 438 | if (fl->pattern_offset > lgr->range.offset) { |
431 | dprintk("%s pattern_offset %lld too large\n", | 439 | dprintk("%s pattern_offset %lld too large\n", |
432 | __func__, fl->pattern_offset); | 440 | __func__, fl->pattern_offset); |
@@ -679,14 +687,49 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | |||
679 | return (p_stripe == r_stripe); | 687 | return (p_stripe == r_stripe); |
680 | } | 688 | } |
681 | 689 | ||
690 | void | ||
691 | filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio, | ||
692 | struct nfs_page *req) | ||
693 | { | ||
694 | BUG_ON(pgio->pg_lseg != NULL); | ||
695 | |||
696 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | ||
697 | req->wb_context, | ||
698 | 0, | ||
699 | NFS4_MAX_UINT64, | ||
700 | IOMODE_READ, | ||
701 | GFP_KERNEL); | ||
702 | /* If no lseg, fall back to read through mds */ | ||
703 | if (pgio->pg_lseg == NULL) | ||
704 | nfs_pageio_init_read_mds(pgio, pgio->pg_inode); | ||
705 | } | ||
706 | |||
707 | void | ||
708 | filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio, | ||
709 | struct nfs_page *req) | ||
710 | { | ||
711 | BUG_ON(pgio->pg_lseg != NULL); | ||
712 | |||
713 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | ||
714 | req->wb_context, | ||
715 | 0, | ||
716 | NFS4_MAX_UINT64, | ||
717 | IOMODE_RW, | ||
718 | GFP_NOFS); | ||
719 | /* If no lseg, fall back to write through mds */ | ||
720 | if (pgio->pg_lseg == NULL) | ||
721 | nfs_pageio_init_write_mds(pgio, pgio->pg_inode, | ||
722 | pgio->pg_ioflags); | ||
723 | } | ||
724 | |||
682 | static const struct nfs_pageio_ops filelayout_pg_read_ops = { | 725 | static const struct nfs_pageio_ops filelayout_pg_read_ops = { |
683 | .pg_init = pnfs_generic_pg_init_read, | 726 | .pg_init = filelayout_pg_init_read, |
684 | .pg_test = filelayout_pg_test, | 727 | .pg_test = filelayout_pg_test, |
685 | .pg_doio = nfs_generic_pg_readpages, | 728 | .pg_doio = nfs_generic_pg_readpages, |
686 | }; | 729 | }; |
687 | 730 | ||
688 | static const struct nfs_pageio_ops filelayout_pg_write_ops = { | 731 | static const struct nfs_pageio_ops filelayout_pg_write_ops = { |
689 | .pg_init = pnfs_generic_pg_init_write, | 732 | .pg_init = filelayout_pg_init_write, |
690 | .pg_test = filelayout_pg_test, | 733 | .pg_test = filelayout_pg_test, |
691 | .pg_doio = nfs_generic_pg_writepages, | 734 | .pg_doio = nfs_generic_pg_writepages, |
692 | }; | 735 | }; |