Here's a patch to fix dm_table_create() in 2.6. This is basically a combination of 2.4.23-pre7-dm3::00016.patch and my patch for dm-table.c in 2.4 which I posted a little while ago. --- a/drivers/md/dm-ioctl-v1.c 29 Sep 2003 15:00:13 -0000 +++ b/drivers/md/dm-ioctl-v1.c 24 Oct 2003 19:07:33 -0000 @@ -566,7 +566,7 @@ if (r) return r; - r = dm_table_create(&t, get_mode(param)); + r = dm_table_create(&t, get_mode(param), param->target_count); if (r) return r; @@ -894,7 +894,7 @@ struct mapped_device *md; struct dm_table *t; - r = dm_table_create(&t, get_mode(param)); + r = dm_table_create(&t, get_mode(param), param->target_count); if (r) return r; --- a/drivers/md/dm-ioctl-v4.c 29 Sep 2003 15:01:15 -0000 +++ b/drivers/md/dm-ioctl-v4.c 24 Oct 2003 19:07:14 -0000 @@ -872,7 +872,7 @@ struct hash_cell *hc; struct dm_table *t; - r = dm_table_create(&t, get_mode(param)); + r = dm_table_create(&t, get_mode(param), param->target_count); if (r) return r; --- a/drivers/md/dm-table.c 9 Oct 2003 16:47:44 -0000 +++ b/drivers/md/dm-table.c 24 Oct 2003 19:08:32 -0000 @@ -202,7 +202,7 @@ return 0; } -int dm_table_create(struct dm_table **result, int mode) +int dm_table_create(struct dm_table **result, int mode, unsigned num_targets) { struct dm_table *t = kmalloc(sizeof(*t), GFP_NOIO); @@ -213,8 +213,12 @@ INIT_LIST_HEAD(&t->devices); atomic_set(&t->holders, 1); - /* allocate a single nodes worth of targets to begin with */ - if (alloc_targets(t, KEYS_PER_NODE)) { + if (!num_targets) + num_targets = KEYS_PER_NODE; + + num_targets = dm_round_up(num_targets, KEYS_PER_NODE); + + if (alloc_targets(t, num_targets)) { kfree(t); t = NULL; return -ENOMEM; --- a/drivers/md/dm.h 20 Oct 2003 16:05:53 -0000 +++ b/drivers/md/dm.h 24 Oct 2003 19:05:44 -0000 @@ -95,7 +95,7 @@ * Functions for manipulating a table. Tables are also reference * counted. *---------------------------------------------------------------*/ -int dm_table_create(struct dm_table **result, int mode); +int dm_table_create(struct dm_table **result, int mode, unsigned num_targets); void dm_table_get(struct dm_table *t); void dm_table_put(struct dm_table *t);