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;
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;
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;
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);
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;
* 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);