aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/objlayout
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-05-25 14:25:29 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 14:03:08 -0400
commit9342077011d54f42fa1b88b7bc1f7008dcf5fff9 (patch)
tree88ef803dae5672d8bb40a563a6d2d301ae2e782f /fs/nfs/objlayout
parent5b36c7dc41d87d39e779a84fdc2b44b39bba32ca (diff)
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/nfs/objlayout')
-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 {
128 u64 group_depth; 128 u64 group_depth;
129 unsigned group_count; 129 unsigned group_count;
130 130
131 unsigned max_io_size;
132
131 unsigned comps_index; 133 unsigned comps_index;
132 unsigned num_comps; 134 unsigned num_comps;
133 /* variable length */ 135 /* variable length */
@@ -365,6 +367,11 @@ int objio_alloc_lseg(struct pnfs_layout_segment **outp,
365 objio_seg->group_count = 1; 367 objio_seg->group_count = 1;
366 } 368 }
367 369
370 /* Cache this calculation it will hit for every page */
371 objio_seg->max_io_size = (BIO_MAX_PAGES_KMALLOC * PAGE_SIZE -
372 objio_seg->stripe_unit) *
373 objio_seg->group_width;
374
368 *outp = &objio_seg->lseg; 375 *outp = &objio_seg->lseg;
369 return 0; 376 return 0;
370 377
@@ -988,6 +995,16 @@ ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable)
988 return _write_exec(ios); 995 return _write_exec(ios);
989} 996}
990 997
998static bool objio_pg_test(struct nfs_pageio_descriptor *pgio,
999 struct nfs_page *prev, struct nfs_page *req)
1000{
1001 if (!pnfs_generic_pg_test(pgio, prev, req))
1002 return false;
1003
1004 return pgio->pg_count + req->wb_bytes <=
1005 OBJIO_LSEG(pgio->pg_lseg)->max_io_size;
1006}
1007
991static struct pnfs_layoutdriver_type objlayout_type = { 1008static struct pnfs_layoutdriver_type objlayout_type = {
992 .id = LAYOUT_OSD2_OBJECTS, 1009 .id = LAYOUT_OSD2_OBJECTS,
993 .name = "LAYOUT_OSD2_OBJECTS", 1010 .name = "LAYOUT_OSD2_OBJECTS",
@@ -1001,7 +1018,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
1001 1018
1002 .read_pagelist = objlayout_read_pagelist, 1019 .read_pagelist = objlayout_read_pagelist,
1003 .write_pagelist = objlayout_write_pagelist, 1020 .write_pagelist = objlayout_write_pagelist,
1004 .pg_test = pnfs_generic_pg_test, 1021 .pg_test = objio_pg_test,
1005 1022
1006 .free_deviceid_node = objio_free_deviceid_node, 1023 .free_deviceid_node = objio_free_deviceid_node,
1007 1024