linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@sistina.com>
To: Joe Thornber <thornber@sistina.com>
Cc: Linux Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@zip.com.au>,
	Linus Torvalds <torvalds@osdl.org>
Subject: [Patch 2/5] dm: remove dynamic table resizing
Date: Tue, 25 Nov 2003 16:31:00 +0000	[thread overview]
Message-ID: <20031125163100.GC524@reti> (raw)
In-Reply-To: <20031125162451.GA524@reti>

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

  parent reply	other threads:[~2003-11-25 16:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 16:24 2.6.0-t10-dm1 Joe Thornber
2003-11-25 16:30 ` [Patch 1/5] dm: fix block device resizing Joe Thornber
2003-11-25 16:31 ` Joe Thornber [this message]
2003-11-25 16:33 ` [Patch 3/5] dm: make v4 of the ioctl interface the default Joe Thornber
2003-11-25 16:47   ` Kevin P. Fleming
2003-11-25 17:05     ` Joe Thornber
2003-11-25 17:15       ` Kevin P. Fleming
2003-11-25 18:00         ` Joe Thornber
2003-11-25 17:29       ` Wichert Akkerman
2003-11-25 20:18         ` Alasdair G Kergon
2003-11-25 23:45           ` Adrian Bunk
2003-11-26 11:39             ` Joe Thornber
2003-11-25 17:09     ` Kevin Corry
2003-11-25 17:16       ` Kevin P. Fleming
2003-11-25 17:28         ` Kevin Corry
2003-11-25 17:20   ` Christoph Hellwig
2003-11-25 17:59     ` Joe Thornber
2003-11-25 16:34 ` [Patch 4/5] dm: set io restriction defaults Joe Thornber
2003-11-25 16:35 ` [Patch 5/5] dm: dm_table_event() sleep on spinlock bug Joe Thornber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031125163100.GC524@reti \
    --to=thornber@sistina.com \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).