aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2011-05-25 13:54:40 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 13:56:55 -0400
commit89a58e32d9105c01022a757fb32ddc3b51bf0025 (patch)
treefd04ff022a084339868e81fc9a4679667c2b70bd /fs
parent18ad0a9f2ccd260d37dd6bc5fa04c7819def4c84 (diff)
NFSv4.1: use pnfs_generic_pg_test directly by layout driver
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4filelayout.c3
-rw-r--r--fs/nfs/objlayout/objio_osd.c14
-rw-r--r--fs/nfs/pnfs.c13
-rw-r--r--fs/nfs/pnfs.h6
4 files changed, 17 insertions, 19 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 24f05720daf1..426908809c97 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -661,6 +661,9 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
661 u64 p_stripe, r_stripe; 661 u64 p_stripe, r_stripe;
662 u32 stripe_unit; 662 u32 stripe_unit;
663 663
664 if (!pnfs_generic_pg_test(pgio, prev, req))
665 return 0;
666
664 if (!pgio->pg_lseg) 667 if (!pgio->pg_lseg)
665 return 1; 668 return 1;
666 p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT; 669 p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT;
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 8c2bd3eb8e8d..3b10d09e5210 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -988,18 +988,6 @@ ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable)
988 return _write_exec(ios); 988 return _write_exec(ios);
989} 989}
990 990
991/*
992 * objlayout_pg_test(). Called by nfs_can_coalesce_requests()
993 *
994 * return true iff coalesce page
995 */
996bool
997objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
998 struct nfs_page *req)
999{
1000 return true;
1001}
1002
1003static struct pnfs_layoutdriver_type objlayout_type = { 991static struct pnfs_layoutdriver_type objlayout_type = {
1004 .id = LAYOUT_OSD2_OBJECTS, 992 .id = LAYOUT_OSD2_OBJECTS,
1005 .name = "LAYOUT_OSD2_OBJECTS", 993 .name = "LAYOUT_OSD2_OBJECTS",
@@ -1013,7 +1001,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
1013 1001
1014 .read_pagelist = objlayout_read_pagelist, 1002 .read_pagelist = objlayout_read_pagelist,
1015 .write_pagelist = objlayout_write_pagelist, 1003 .write_pagelist = objlayout_write_pagelist,
1016 .pg_test = objlayout_pg_test, 1004 .pg_test = pnfs_generic_pg_test,
1017 1005
1018 .free_deviceid_node = objio_free_deviceid_node, 1006 .free_deviceid_node = objio_free_deviceid_node,
1019 1007
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 212fc292761a..d79f2df33a46 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1067,12 +1067,17 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
1067 pgio->pg_count, 1067 pgio->pg_count,
1068 access_type, 1068 access_type,
1069 gfp_flags); 1069 gfp_flags);
1070 } else if (pgio->pg_lseg && 1070 return true;
1071 req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset, 1071 }
1072 pgio->pg_lseg->pls_range.length)) 1072
1073 if (pgio->pg_lseg &&
1074 req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset,
1075 pgio->pg_lseg->pls_range.length))
1073 return false; 1076 return false;
1074 return NFS_SERVER(pgio->pg_inode)->pnfs_curr_ld->pg_test(pgio, prev, req); 1077
1078 return true;
1075} 1079}
1080EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);
1076 1081
1077/* 1082/*
1078 * Called by non rpc-based layout drivers 1083 * Called by non rpc-based layout drivers
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 65daae59c8ae..48d0a8e4d062 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -295,8 +295,10 @@ static inline int pnfs_return_layout(struct inode *ino)
295static inline void pnfs_pageio_init(struct nfs_pageio_descriptor *pgio, 295static inline void pnfs_pageio_init(struct nfs_pageio_descriptor *pgio,
296 struct inode *inode) 296 struct inode *inode)
297{ 297{
298 if (NFS_SERVER(inode)->pnfs_curr_ld) 298 struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
299 pgio->pg_test = pnfs_generic_pg_test; 299
300 if (ld)
301 pgio->pg_test = ld->pg_test;
300} 302}
301 303
302#else /* CONFIG_NFS_V4_1 */ 304#else /* CONFIG_NFS_V4_1 */