summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-05-25 21:25:29 +0300
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 21:03:08 +0300
commit9342077011d54f42fa1b88b7bc1f7008dcf5fff9 (patch)
tree88ef803dae5672d8bb40a563a6d2d301ae2e782f /fs
parent5b36c7dc41d87d39e779a84fdc2b44b39bba32ca (diff)
downloadlinux-9342077011d54f42fa1b88b7bc1f7008dcf5fff9.tar.gz
linux-9342077011d54f42fa1b88b7bc1f7008dcf5fff9.tar.bz2
linux-9342077011d54f42fa1b88b7bc1f7008dcf5fff9.zip
pnfs-obj: pg_test check for max_io_size
Implement pg_test vector to test for max IO sizes. We calculate a max_io_size member only once, and cache it in lseg so to not do so on every page insert. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> [simplify logic] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/objlayout/objio_osd.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 3b10d09e5210..9cf208df1f25 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -128,6 +128,8 @@ struct objio_segment {
u64 group_depth;
unsigned group_count;
+ unsigned max_io_size;
+
unsigned comps_index;
unsigned num_comps;
/* variable length */
@@ -365,6 +367,11 @@ int objio_alloc_lseg(struct pnfs_layout_segment **outp,
objio_seg->group_count = 1;
}
+ /* Cache this calculation it will hit for every page */
+ objio_seg->max_io_size = (BIO_MAX_PAGES_KMALLOC * PAGE_SIZE -
+ objio_seg->stripe_unit) *
+ objio_seg->group_width;
+
*outp = &objio_seg->lseg;
return 0;
@@ -988,6 +995,16 @@ ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable)
return _write_exec(ios);
}
+static bool objio_pg_test(struct nfs_pageio_descriptor *pgio,
+ struct nfs_page *prev, struct nfs_page *req)
+{
+ if (!pnfs_generic_pg_test(pgio, prev, req))
+ return false;
+
+ return pgio->pg_count + req->wb_bytes <=
+ OBJIO_LSEG(pgio->pg_lseg)->max_io_size;
+}
+
static struct pnfs_layoutdriver_type objlayout_type = {
.id = LAYOUT_OSD2_OBJECTS,
.name = "LAYOUT_OSD2_OBJECTS",
@@ -1001,7 +1018,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
.read_pagelist = objlayout_read_pagelist,
.write_pagelist = objlayout_write_pagelist,
- .pg_test = pnfs_generic_pg_test,
+ .pg_test = objio_pg_test,
.free_deviceid_node = objio_free_deviceid_node,