NFSv4.1: use pnfs_generic_pg_test directly by layout driver
authorBenny Halevy <bhalevy@panasas.com>
Wed, 25 May 2011 17:54:40 +0000 (20:54 +0300)
committerBoaz Harrosh <bharrosh@panasas.com>
Sun, 29 May 2011 17:56:55 +0000 (20:56 +0300)
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
fs/nfs/nfs4filelayout.c
fs/nfs/objlayout/objio_osd.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h

index 24f05720daf1d8c0d612eada32cdc0ca4288d6e3..426908809c9738601f00cbf25fd220512f2141c1 100644 (file)
@@ -661,6 +661,9 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
        u64 p_stripe, r_stripe;
        u32 stripe_unit;
 
+       if (!pnfs_generic_pg_test(pgio, prev, req))
+               return 0;
+
        if (!pgio->pg_lseg)
                return 1;
        p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT;
index 8c2bd3eb8e8d27e2dbddf07f9bfa294774e5abf0..3b10d09e52103fe5e994b72331d25eba02c719a0 100644 (file)
@@ -988,18 +988,6 @@ ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable)
        return _write_exec(ios);
 }
 
-/*
- * objlayout_pg_test(). Called by nfs_can_coalesce_requests()
- *
- * return true iff coalesce page
- */
-bool
-objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
-                  struct nfs_page *req)
-{
-       return true;
-}
-
 static struct pnfs_layoutdriver_type objlayout_type = {
        .id = LAYOUT_OSD2_OBJECTS,
        .name = "LAYOUT_OSD2_OBJECTS",
@@ -1013,7 +1001,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
 
        .read_pagelist           = objlayout_read_pagelist,
        .write_pagelist          = objlayout_write_pagelist,
-       .pg_test                 = objlayout_pg_test,
+       .pg_test                 = pnfs_generic_pg_test,
 
        .free_deviceid_node      = objio_free_deviceid_node,
 
index 212fc292761a07dbcfa7aa264bfa989046244cff..d79f2df33a46466ef83652c12dcc5e18b3e74ab2 100644 (file)
@@ -1067,12 +1067,17 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
                                                   pgio->pg_count,
                                                   access_type,
                                                   gfp_flags);
-       } else if (pgio->pg_lseg &&
-                  req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset,
-                                               pgio->pg_lseg->pls_range.length))
+               return true;
+       }
+
+       if (pgio->pg_lseg &&
+           req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset,
+                                        pgio->pg_lseg->pls_range.length))
                return false;
-       return NFS_SERVER(pgio->pg_inode)->pnfs_curr_ld->pg_test(pgio, prev, req);
+
+       return true;
 }
+EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);
 
 /*
  * Called by non rpc-based layout drivers
index 65daae59c8ae75072f02cf4c78b3831b3a6187e6..48d0a8e4d06212264469df6b4c21acba110597f0 100644 (file)
@@ -295,8 +295,10 @@ static inline int pnfs_return_layout(struct inode *ino)
 static inline void pnfs_pageio_init(struct nfs_pageio_descriptor *pgio,
                                    struct inode *inode)
 {
-       if (NFS_SERVER(inode)->pnfs_curr_ld)
-               pgio->pg_test = pnfs_generic_pg_test;
+       struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
+
+       if (ld)
+               pgio->pg_test = ld->pg_test;
 }
 
 #else  /* CONFIG_NFS_V4_1 */