All of lore.kernel.org
 help / color / mirror / Atom feed
From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW_DM libdm/libdm-deptree.c
Date: 14 Oct 2011 13:34:20 -0000	[thread overview]
Message-ID: <20111014133420.24391.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2011-10-14 13:34:19

Modified files:
	.              : WHATS_NEW_DM 
	libdm          : libdm-deptree.c 

Log message:
	Use pool for dm_tree allocation
	
	Using the same pool allocation strategy as we use for vg,
	so dm_tree structure is part of the pool itself.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.509&r2=1.510
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123

--- LVM2/WHATS_NEW_DM	2011/10/03 18:28:25	1.509
+++ LVM2/WHATS_NEW_DM	2011/10/14 13:34:19	1.510
@@ -1,5 +1,6 @@
 Version 1.02.68 -
 ==================================
+  Allocate dm_tree structure from dm_tree pool.
   Update debug logging for _resume_node.
   Add functions to support thin provisioning target (API unstable).
   Improve libdm-config error path reporting.
--- LVM2/libdm/libdm-deptree.c	2011/10/06 14:45:42	1.122
+++ LVM2/libdm/libdm-deptree.c	2011/10/14 13:34:19	1.123
@@ -248,10 +248,14 @@
 
 struct dm_tree *dm_tree_create(void)
 {
+	struct dm_pool *dmem;
 	struct dm_tree *dtree;
 
-	if (!(dtree = dm_zalloc(sizeof(*dtree)))) {
-		log_error("dm_tree_create malloc failed");
+	if (!(dmem = dm_pool_create("dtree", 1024)) ||
+	    !(dtree = dm_pool_zalloc(dmem, sizeof(*dtree)))) {
+		log_error("Failed to allocate dtree.");
+		if (dmem)
+			dm_pool_destroy(dmem);
 		return NULL;
 	}
 
@@ -260,17 +264,11 @@
 	dm_list_init(&dtree->root.used_by);
 	dtree->skip_lockfs = 0;
 	dtree->no_flush = 0;
-
-	if (!(dtree->mem = dm_pool_create("dtree", 1024))) {
-		log_error("dtree pool creation failed");
-		dm_free(dtree);
-		return NULL;
-	}
+	dtree->mem = dmem;
 
 	if (!(dtree->devs = dm_hash_create(8))) {
 		log_error("dtree hash creation failed");
 		dm_pool_destroy(dtree->mem);
-		dm_free(dtree);
 		return NULL;
 	}
 
@@ -278,7 +276,6 @@
 		log_error("dtree uuid hash creation failed");
 		dm_hash_destroy(dtree->devs);
 		dm_pool_destroy(dtree->mem);
-		dm_free(dtree);
 		return NULL;
 	}
 
@@ -293,7 +290,6 @@
 	dm_hash_destroy(dtree->uuids);
 	dm_hash_destroy(dtree->devs);
 	dm_pool_destroy(dtree->mem);
-	dm_free(dtree);
 }
 
 static int _nodes_are_linked(const struct dm_tree_node *parent,



             reply	other threads:[~2011-10-14 13:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 13:34 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-15 21:27 LVM2 ./WHATS_NEW_DM libdm/libdm-deptree.c agk
2012-02-10 14:48 zkabelac
2012-02-10 14:42 zkabelac
2012-01-25 21:50 zkabelac
2011-10-17 13:15 mbroz
2011-10-03 18:28 zkabelac
2011-09-07  8:37 zkabelac
2011-02-18 16:13 zkabelac
2009-07-03 12:45 agk
2008-12-11 16:25 zkabelac
2008-12-11 16:35 ` Dave Wysochanski
2008-12-12  0:07   ` Alasdair G Kergon
2008-12-12  9:26   ` Zdenek Kabelac
2008-12-12 13:29     ` Dave Wysochanski
2008-12-12 14:00       ` Zdenek Kabelac
2008-12-12  0:02 ` 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=20111014133420.24391.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --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.