public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes
@ 2004-06-30 19:52 Kevin Corry
  2004-06-30 19:57 ` [PATCH] 1/4: DM: kcopyd.c: Remove unused include Kevin Corry
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kevin Corry @ 2004-06-30 19:52 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: LKML

Patches against 2.6.7-bk13.

Revision 1:
  kcopyd.c: Remove unused #include.

Revision 2:
  kcopyd.c: client_add() can return void instead of an int, which will
  eliminate an unnecessary error path in kcopyd_client_create().

Revision 3:
  dm-raid1.c: Since kcopyd can currently only handle 1 source and up to 8
  destinations, enforce a max of 9 mirrors when creating a dm-mirror device.

Revision 4:
  dm-raid1.c: Declare fixed-sized (instead of variable-sized) arrays on the
  stack in recover() and do_write().

-- 
Kevin Corry
kevcorry@us.ibm.com
http://evms.sourceforge.net/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] 1/4: DM: kcopyd.c: Remove unused include
  2004-06-30 19:52 [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes Kevin Corry
@ 2004-06-30 19:57 ` Kevin Corry
  2004-06-30 19:57 ` [PATCH] 2/4: DM: kcopyd.c: make client_add() return void Kevin Corry
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Corry @ 2004-06-30 19:57 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: LKML

kcopyd.c: Remove unused #include.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

--- diff/drivers/md/kcopyd.c	2004-06-30 08:45:34.513303448 -0500
+++ source/drivers/md/kcopyd.c	2004-06-30 08:48:15.384847256 -0500
@@ -24,9 +24,6 @@
 
 #include "kcopyd.h"
 
-/* FIXME: this is only needed for the DMERR macros */
-#include "dm.h"
-
 static struct workqueue_struct *_kcopyd_wq;
 static struct work_struct _kcopyd_work;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] 2/4: DM: kcopyd.c: make client_add() return void
  2004-06-30 19:52 [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes Kevin Corry
  2004-06-30 19:57 ` [PATCH] 1/4: DM: kcopyd.c: Remove unused include Kevin Corry
@ 2004-06-30 19:57 ` Kevin Corry
  2004-06-30 19:58 ` [PATCH] 3/4: DM: dm-raid1.c: Enforce max of 9 mirrors Kevin Corry
  2004-06-30 19:58 ` [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays Kevin Corry
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Corry @ 2004-06-30 19:57 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: LKML

kcopyd.c: client_add() can return void instead of an int, which will eliminate
an unnecessary error path in kcopyd_client_create().

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

--- diff/drivers/md/kcopyd.c	2004-06-30 08:48:15.384847256 -0500
+++ source/drivers/md/kcopyd.c	2004-06-30 08:48:19.528217368 -0500
@@ -573,12 +573,11 @@
 static DECLARE_MUTEX(_client_lock);
 static LIST_HEAD(_clients);
 
-static int client_add(struct kcopyd_client *kc)
+static void client_add(struct kcopyd_client *kc)
 {
 	down(&_client_lock);
 	list_add(&kc->list, &_clients);
 	up(&_client_lock);
-	return 0;
 }
 
 static void client_del(struct kcopyd_client *kc)
@@ -668,15 +667,7 @@
 		return r;
 	}
 
-	r = client_add(kc);
-	if (r) {
-		dm_io_put(nr_pages);
-		client_free_pages(kc);
-		kfree(kc);
-		kcopyd_exit();
-		return r;
-	}
-
+	client_add(kc);
 	*result = kc;
 	return 0;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] 3/4: DM: dm-raid1.c: Enforce max of 9 mirrors
  2004-06-30 19:52 [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes Kevin Corry
  2004-06-30 19:57 ` [PATCH] 1/4: DM: kcopyd.c: Remove unused include Kevin Corry
  2004-06-30 19:57 ` [PATCH] 2/4: DM: kcopyd.c: make client_add() return void Kevin Corry
@ 2004-06-30 19:58 ` Kevin Corry
  2004-06-30 19:58 ` [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays Kevin Corry
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Corry @ 2004-06-30 19:58 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: LKML

dm-raid1.c: Since kcopyd can currently only handle 1 source and up to 8
destinations, enforce a max of 9 mirrors when creating a dm-mirror device.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

--- diff/drivers/md/dm-raid1.c	2004-06-30 08:45:34.500305424 -0500
+++ source/drivers/md/dm-raid1.c	2004-06-30 08:48:25.247347928 -0500
@@ -1028,7 +1028,7 @@
 	argc -= args_used;
 
 	if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 ||
-	    nr_mirrors < 2) {
+	    nr_mirrors < 2 || nr_mirrors > KCOPYD_MAX_REGIONS + 1) {
 		ti->error = "dm-mirror: Invalid number of mirrors";
 		dm_destroy_dirty_log(dl);
 		return -EINVAL;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays
  2004-06-30 19:52 [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes Kevin Corry
                   ` (2 preceding siblings ...)
  2004-06-30 19:58 ` [PATCH] 3/4: DM: dm-raid1.c: Enforce max of 9 mirrors Kevin Corry
@ 2004-06-30 19:58 ` Kevin Corry
  2004-06-30 20:07   ` Michael Buesch
  3 siblings, 1 reply; 7+ messages in thread
From: Kevin Corry @ 2004-06-30 19:58 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: LKML

dm-raid1.c: Declare fixed-sized (instead of variable-sized) arrays on the
stack in recover() and do_write().

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

--- diff/drivers/md/dm-raid1.c	2004-06-30 08:48:25.247347928 -0500
+++ source/drivers/md/dm-raid1.c	2004-06-30 08:48:30.101609968 -0500
@@ -602,7 +602,7 @@
 {
 	int r;
 	unsigned int i;
-	struct io_region from, to[ms->nr_mirrors - 1], *dest;
+	struct io_region from, to[KCOPYD_MAX_REGIONS], *dest;
 	struct mirror *m;
 	unsigned long flags = 0;
 
@@ -757,7 +757,7 @@
 static void do_write(struct mirror_set *ms, struct bio *bio)
 {
 	unsigned int i;
-	struct io_region io[ms->nr_mirrors];
+	struct io_region io[KCOPYD_MAX_REGIONS+1];
 	struct mirror *m;
 
 	for (i = 0; i < ms->nr_mirrors; i++) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays
  2004-06-30 19:58 ` [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays Kevin Corry
@ 2004-06-30 20:07   ` Michael Buesch
  2004-06-30 20:28     ` Jedi/Sector One
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Buesch @ 2004-06-30 20:07 UTC (permalink / raw)
  To: Kevin Corry; +Cc: LKML

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoting Kevin Corry <kevcorry@us.ibm.com>:
> -	struct io_region from, to[ms->nr_mirrors - 1], *dest;

Heh? Could someone please explain how this could compile?
Dynamic allocation on the stack? I'm confused.

- --
Regards Michael Buesch  [ http://www.tuxsoft.de.vu ]


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA4x2ZFGK1OIvVOP4RAnH3AKDhNlOgKWvx/GqWVROutfqEUpnc1QCbBz1j
koxiQ/7WtV/QOocbgYTHi4E=
=7Ch5
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays
  2004-06-30 20:07   ` Michael Buesch
@ 2004-06-30 20:28     ` Jedi/Sector One
  0 siblings, 0 replies; 7+ messages in thread
From: Jedi/Sector One @ 2004-06-30 20:28 UTC (permalink / raw)
  To: LKML

On Wed, Jun 30, 2004 at 10:07:53PM +0200, Michael Buesch wrote:
> Quoting Kevin Corry <kevcorry@us.ibm.com>:
> > -	struct io_region from, to[ms->nr_mirrors - 1], *dest;
> 
> Heh? Could someone please explain how this could compile?

  Such a dynamic allocation on the stack is a GCC extension, implemented for
a very long time.

  I guess this is not very different from alloca().
  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-06-30 20:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-30 19:52 [PATCH] 0/4: Device-Mapper: Minor cleanups and fixes Kevin Corry
2004-06-30 19:57 ` [PATCH] 1/4: DM: kcopyd.c: Remove unused include Kevin Corry
2004-06-30 19:57 ` [PATCH] 2/4: DM: kcopyd.c: make client_add() return void Kevin Corry
2004-06-30 19:58 ` [PATCH] 3/4: DM: dm-raid1.c: Enforce max of 9 mirrors Kevin Corry
2004-06-30 19:58 ` [PATCH] 4/4: DM: dm-raid1.c: Use fixed-size arrays Kevin Corry
2004-06-30 20:07   ` Michael Buesch
2004-06-30 20:28     ` Jedi/Sector One

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox