Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/pv_map.c tools/t ...

PATCH [email protected] 1 participant 1 message Oct 21, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2006-10-21 23:18:44

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : pv_map.c 
	tools          : toollib.c 

Log message:
Cope if same PV is included more than once in cmdline PE range list.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.475&r2=1.476
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_map.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  Cope if same PV is included more than once in cmdline PE range list.
   Set PV size to current device size if it is found to be zero.
   Add segment parameter to target_present functions.
 
lib/metadata/pv_map.c +20 -9
@@ -19,6 +19,8 @@
 
 /*
  * Areas are maintained in size order, largest first.
+ *
+ * FIXME Cope with overlap.
  */
 static void _insert_area(struct list *head, struct pv_area *a)
 {
@@ -126,22 +128,31 @@
 
 static int _create_maps(struct dm_pool *mem, struct list *pvs, struct list *pvms)
 {
-	struct pv_map *pvm;
+	struct pv_map *pvm, *pvm2;
 	struct pv_list *pvl;
 
 	list_iterate_items(pvl, pvs) {
 		if (!(pvl->pv->status & ALLOCATABLE_PV))
 			continue;
 
-		if (!(pvm = dm_pool_zalloc(mem, sizeof(*pvm)))) {
-			stack;
-			return 0;
-		}
+		pvm = NULL;
 
-		pvm->pv = pvl->pv;
-
-		list_init(&pvm->areas);
-		list_add(pvms, &pvm->list);
+		list_iterate_items(pvm2, pvms)
+			if (pvm2->pv->dev == pvl->pv->dev) {
+				pvm = pvm2;
+				break;
+			}
+
+		if (!pvm) {
+			if (!(pvm = dm_pool_zalloc(mem, sizeof(*pvm)))) {
+				stack;
+				return 0;
+			}
+
+			pvm->pv = pvl->pv;
+			list_init(&pvm->areas);
+			list_add(pvms, &pvm->list);
+		}
 
 		if (!_create_all_areas_for_pv(mem, pvm, pvl->pe_ranges)) {
 			stack;
tools/toollib.c +48 -30

153 lines not on this page · raw message