lkml.org 
[lkml]   [2003]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[Patch 2/5] dm: remove dynamic table resizing
The dm table size is always known in advance, so we can specify it in
dm_table_create(), rather than relying on dynamic resizing.
--- diff/drivers/md/dm-ioctl-v1.c 2003-09-30 15:46:14.000000000 +0100
+++ source/drivers/md/dm-ioctl-v1.c 2003-11-25 15:47:38.000000000 +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;

--- diff/drivers/md/dm-ioctl-v4.c 2003-09-30 15:46:14.000000000 +0100
+++ source/drivers/md/dm-ioctl-v4.c 2003-11-25 15:47:38.000000000 +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;

--- diff/drivers/md/dm-table.c 2003-11-25 15:24:57.000000000 +0000
+++ source/drivers/md/dm-table.c 2003-11-25 15:47:38.000000000 +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;
--- diff/drivers/md/dm.h 2003-08-20 14:16:09.000000000 +0100
+++ source/drivers/md/dm.h 2003-11-25 15:47:38.000000000 +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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.094 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site