public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: jbrassow@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib metadata/raid_manip.c raid/raid.c
Date: Thu, 11 Aug 2011 21:32:00 -0000	[thread overview]
Message-ID: <20110811213219.22981.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2011-08-11 21:32:19

Modified files:
	lib/metadata   : raid_manip.c 
	lib/raid       : raid.c 

Log message:
	Various code clean-ups (s/malloc/zalloc/, new msgs, etc)
	
	Fix a couple more issues that kabi found.
	- Add some error messages in failure cases
	- s/malloc/zalloc/
	- use vg->vgmem for lv names instead of vg->cmd->mem

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/raid/raid.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/lib/metadata/raid_manip.c	2011/08/11 19:17:10	1.2
+++ LVM2/lib/metadata/raid_manip.c	2011/08/11 21:32:18	1.3
@@ -242,7 +242,7 @@
 {
 	int len;
 	char *tmp_name;
-	struct cmd_context *cmd = seg->lv->vg->cmd;
+	struct volume_group *vg = seg->lv->vg;
 	struct logical_volume *data_lv = seg_lv(seg, idx);
 	struct logical_volume *meta_lv = seg_metalv(seg, idx);
 
@@ -262,14 +262,14 @@
 	seg_metatype(seg, idx) = AREA_UNASSIGNED;
 
 	len = strlen(meta_lv->name) + strlen("_extracted") + 1;
-	tmp_name = dm_pool_alloc(cmd->mem, len);
+	tmp_name = dm_pool_alloc(vg->vgmem, len);
 	if (!tmp_name)
 		return_0;
 	sprintf(tmp_name, "%s_extracted", meta_lv->name);
 	meta_lv->name = tmp_name;
 
 	len = strlen(data_lv->name) + strlen("_extracted") + 1;
-	tmp_name = dm_pool_alloc(cmd->mem, len);
+	tmp_name = dm_pool_alloc(vg->vgmem, len);
 	if (!tmp_name)
 		return_0;
 	sprintf(tmp_name, "%s_extracted", data_lv->name);
--- LVM2/lib/raid/raid.c	2011/08/11 14:00:58	1.4
+++ LVM2/lib/raid/raid.c	2011/08/11 21:32:19	1.5
@@ -321,11 +321,13 @@
 static struct segment_type *init_raid_segtype(struct cmd_context *cmd,
 					      const char *raid_type)
 {
-	struct segment_type *segtype = dm_malloc(sizeof(*segtype));
+	struct segment_type *segtype = dm_zalloc(sizeof(*segtype));
 
-	if (!segtype)
+	if (!segtype) {
+		log_error("Failed to allocate memory for %s segtype",
+			  raid_type);
 		return_NULL;
-
+	}
 	segtype->cmd = cmd;
 
 	segtype->flags = SEG_RAID;


             reply	other threads:[~2011-08-11 21:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 21:32 jbrassow [this message]
2011-08-13  4:28 jbrassow

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=20110811213219.22981.qmail@sourceware.org \
    --to=jbrassow@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).