* [PATCH] fix dm debug pool issues
@ 2009-03-25 17:07 Milan Broz
2009-03-25 17:33 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2009-03-25 17:07 UTC (permalink / raw)
To: lvm-devel
fix some issues when compiling with -D DEBUG_POOL
- fix compilation issues
- fix wrong pool object maipulation (lvm dumpconfig triggers assert)
Signed-off-by: Milan Broz <mbroz@redhat.com>
diff --git a/lib/config/config.c b/lib/config/config.c
index c80f18e..224f2ce 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -457,9 +457,9 @@ static int _write_config(struct config_node *n, int only_one,
line_append(" {");
if (!_line_end(outline))
return_0;
+ _write_config(n->child, 0, outline, level + 1);
if (!_line_start(outline))
return_0;
- _write_config(n->child, 0, outline, level + 1);
line_append("%s}", space);
} else {
/* it's a value */
diff --git a/libdm/mm/pool-debug.c b/libdm/mm/pool-debug.c
index b656cc2..911f8e2 100644
--- a/libdm/mm/pool-debug.c
+++ b/libdm/mm/pool-debug.c
@@ -14,6 +14,7 @@
*/
#include "dmlib.h"
+#include <assert.h>
struct block {
struct block *next;
@@ -43,7 +44,7 @@ struct dm_pool {
/* by default things come out aligned for doubles */
#define DEFAULT_ALIGNMENT __alignof__ (double)
-struct pool *dm_pool_create(const char *name, size_t chunk_hint)
+struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
{
struct dm_pool *mem = dm_malloc(sizeof(*mem));
@@ -130,8 +131,6 @@ static void _append_block(struct dm_pool *p, struct block *b)
static struct block *_new_block(size_t s, unsigned alignment)
{
- static const char *_oom = "Out of memory";
-
/* FIXME: I'm currently ignoring the alignment arg. */
size_t len = sizeof(struct block) + s;
struct block *b = dm_malloc(len);
@@ -144,12 +143,12 @@ static struct block *_new_block(size_t s, unsigned alignment)
assert(alignment == DEFAULT_ALIGNMENT);
if (!b) {
- log_err(_oom);
+ log_err("Out of memory");
return NULL;
}
if (!(b->data = dm_malloc(s))) {
- log_err(_oom);
+ log_err("Out of memory");
dm_free(b);
return NULL;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] fix dm debug pool issues
2009-03-25 17:07 [PATCH] fix dm debug pool issues Milan Broz
@ 2009-03-25 17:33 ` Alasdair G Kergon
2009-03-25 17:53 ` Milan Broz
0 siblings, 1 reply; 4+ messages in thread
From: Alasdair G Kergon @ 2009-03-25 17:33 UTC (permalink / raw)
To: lvm-devel
On Wed, Mar 25, 2009 at 06:07:22PM +0100, Milan Broz wrote:
> - fix compilation issues
> - fix wrong pool object maipulation (lvm dumpconfig triggers assert)
Ack.
Alasdair
--
agk at redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] fix dm debug pool issues
2009-03-25 17:33 ` Alasdair G Kergon
@ 2009-03-25 17:53 ` Milan Broz
2009-03-25 18:09 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2009-03-25 17:53 UTC (permalink / raw)
To: lvm-devel
and next obvious problem with pool data caught by pool debug:
- second iteration in loop operates on non-existing object here
Signed-off-by: Milan Broz <mbroz@redhat.com>
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2661e0c..991d63c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -611,12 +611,12 @@ static int _log_parallel_areas(struct dm_pool *mem, struct dm_list *parallel_are
if (!parallel_areas)
return 1;
- if (!dm_pool_begin_object(mem, 256)) {
- log_error("dm_pool_begin_object failed");
- return 0;
- }
-
dm_list_iterate_items(spvs, parallel_areas) {
+ if (!dm_pool_begin_object(mem, 256)) {
+ log_error("dm_pool_begin_object failed");
+ return 0;
+ }
+
dm_list_iterate_items(pvl, &spvs->pvs) {
if (!dm_pool_grow_object(mem, pv_dev_name(pvl->pv), strlen(pv_dev_name(pvl->pv)))) {
log_error("dm_pool_grow_object failed");
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-25 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25 17:07 [PATCH] fix dm debug pool issues Milan Broz
2009-03-25 17:33 ` Alasdair G Kergon
2009-03-25 17:53 ` Milan Broz
2009-03-25 18:09 ` Alasdair G Kergon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.