All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] fix dm debug pool issues
Date: Wed, 25 Mar 2009 18:07:22 +0100	[thread overview]
Message-ID: <49CA64CA.6010708@redhat.com> (raw)

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




             reply	other threads:[~2009-03-25 17:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25 17:07 Milan Broz [this message]
2009-03-25 17:33 ` [PATCH] fix dm debug pool issues Alasdair G Kergon
2009-03-25 17:53   ` Milan Broz
2009-03-25 18:09     ` Alasdair G Kergon

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=49CA64CA.6010708@redhat.com \
    --to=mbroz@redhat.com \
    --cc=lvm-devel@redhat.com \
    /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 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.