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 | |
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')
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 47 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 6 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 6 | ||||
-rw-r--r-- | fs/nfs/read.c | 1 | ||||
-rw-r--r-- | fs/nfs/write.c | 1 |
5 files changed, 57 insertions, 4 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 | }; |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index cc807fe46953..a7dc3367a857 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -911,7 +911,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo, | |||
911 | * Layout segment is retreived from the server if not cached. | 911 | * Layout segment is retreived from the server if not cached. |
912 | * The appropriate layout segment is referenced and returned to the caller. | 912 | * The appropriate layout segment is referenced and returned to the caller. |
913 | */ | 913 | */ |
914 | static struct pnfs_layout_segment * | 914 | struct pnfs_layout_segment * |
915 | pnfs_update_layout(struct inode *ino, | 915 | pnfs_update_layout(struct inode *ino, |
916 | struct nfs_open_context *ctx, | 916 | struct nfs_open_context *ctx, |
917 | loff_t pos, | 917 | loff_t pos, |
@@ -980,7 +980,8 @@ pnfs_update_layout(struct inode *ino, | |||
980 | arg.offset -= pg_offset; | 980 | arg.offset -= pg_offset; |
981 | arg.length += pg_offset; | 981 | arg.length += pg_offset; |
982 | } | 982 | } |
983 | arg.length = PAGE_CACHE_ALIGN(arg.length); | 983 | if (arg.length != NFS4_MAX_UINT64) |
984 | arg.length = PAGE_CACHE_ALIGN(arg.length); | ||
984 | 985 | ||
985 | lseg = send_layoutget(lo, ctx, &arg, gfp_flags); | 986 | lseg = send_layoutget(lo, ctx, &arg, gfp_flags); |
986 | if (!lseg && first) { | 987 | if (!lseg && first) { |
@@ -998,6 +999,7 @@ out_unlock: | |||
998 | spin_unlock(&ino->i_lock); | 999 | spin_unlock(&ino->i_lock); |
999 | goto out; | 1000 | goto out; |
1000 | } | 1001 | } |
1002 | EXPORT_SYMBOL_GPL(pnfs_update_layout); | ||
1001 | 1003 | ||
1002 | int | 1004 | int |
1003 | pnfs_layout_process(struct nfs4_layoutget *lgp) | 1005 | pnfs_layout_process(struct nfs4_layoutget *lgp) |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 1cfc96f8c45b..678c4c7b14d9 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -185,6 +185,12 @@ int pnfs_layoutcommit_inode(struct inode *inode, bool sync); | |||
185 | int _pnfs_return_layout(struct inode *); | 185 | int _pnfs_return_layout(struct inode *); |
186 | int pnfs_ld_write_done(struct nfs_write_data *); | 186 | int pnfs_ld_write_done(struct nfs_write_data *); |
187 | int pnfs_ld_read_done(struct nfs_read_data *); | 187 | int pnfs_ld_read_done(struct nfs_read_data *); |
188 | struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, | ||
189 | struct nfs_open_context *ctx, | ||
190 | loff_t pos, | ||
191 | u64 count, | ||
192 | enum pnfs_iomode iomode, | ||
193 | gfp_t gfp_flags); | ||
188 | 194 | ||
189 | /* pnfs_dev.c */ | 195 | /* pnfs_dev.c */ |
190 | struct nfs4_deviceid_node { | 196 | struct nfs4_deviceid_node { |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 9b2a1d7fb760..c394662c790e 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -120,6 +120,7 @@ void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio, | |||
120 | nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, | 120 | nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, |
121 | NFS_SERVER(inode)->rsize, 0); | 121 | NFS_SERVER(inode)->rsize, 0); |
122 | } | 122 | } |
123 | EXPORT_SYMBOL_GPL(nfs_pageio_init_read_mds); | ||
123 | 124 | ||
124 | static void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, | 125 | static void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, |
125 | struct inode *inode) | 126 | struct inode *inode) |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 00940dc9ab04..7f8732e31982 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1046,6 +1046,7 @@ void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio, | |||
1046 | nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops, | 1046 | nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops, |
1047 | NFS_SERVER(inode)->wsize, ioflags); | 1047 | NFS_SERVER(inode)->wsize, ioflags); |
1048 | } | 1048 | } |
1049 | EXPORT_SYMBOL_GPL(nfs_pageio_init_write_mds); | ||
1049 | 1050 | ||
1050 | static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, | 1051 | static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, |
1051 | struct inode *inode, int ioflags) | 1052 | struct inode *inode, int ioflags) |