Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/metadata.c

PATCH [email protected] 1 participant 1 message Feb 13, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-02-13 10:51:53

Modified files:
. : WHATS_NEW
lib/metadata : metadata.c

Log message:
Log error reporting for failing _alloc_pv

Drop unneeded zeroing of zalloced memory region.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2280&r2=1.2281
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.480&r2=1.481

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.92 - 
 ====================================
+  Report allocation failure for allocation of PV structure.
   Add clvmd init dependency on dlm service when running with new corosync.
 
 Version 2.02.91 - 12th February 2012
lib/metadata/metadata.c +6 -13
@@ -1557,21 +1557,14 @@
 
 static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev)
 {
-	struct physical_volume *pv = dm_pool_zalloc(mem, sizeof(*pv));
+	struct physical_volume *pv;
 
-	if (!pv)
-		return_NULL;
+	if (!(pv = dm_pool_zalloc(mem, sizeof(*pv)))) {
+		log_error("Failed to allocate pv structure.");
+		return NULL;
+	}
 
-	pv_set_fid(pv, NULL);
-	pv->pe_size = 0;
-	pv->pe_start = 0;
-	pv->pe_count = 0;
-	pv->pe_alloc_count = 0;
-	pv->pe_align = 0;
-	pv->pe_align_offset = 0;
-	pv->fmt = NULL;
 	pv->dev = dev;
-
 	pv->status = ALLOCATABLE_PV;
 
 	dm_list_init(&pv->tags);
@@ -1621,7 +1614,7 @@
 	unsigned mda_index;
 
 	if (!pv)
-		return NULL;
+		return_NULL;
 
 	if (id)
 		memcpy(&pv->id, id, sizeof(*id));