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
[email protected]
http://evms.sourceforge.net/
kcopyd.c: Remove unused #include.
Signed-off-by: Kevin Corry <[email protected]>
--- 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;
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 <[email protected]>
--- 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;
}
dm-raid1.c: Declare fixed-sized (instead of variable-sized) arrays on the
stack in recover() and do_write().
Signed-off-by: Kevin Corry <[email protected]>
--- 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++) {
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 <[email protected]>
--- 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;
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoting Kevin Corry <[email protected]>:
> - 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-----
On Wed, Jun 30, 2004 at 10:07:53PM +0200, Michael Buesch wrote:
> Quoting Kevin Corry <[email protected]>:
> > - 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().