Skip to contentSkip to conversation

LVM2/lib/metadata mirror.c

PATCH [email protected] 1 participant 1 message Sep 14, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2011-09-14 04:10:27

Modified files:
lib/metadata : mirror.c

Log message:
Additional fixes for lv_mirror_count.

Changing lv_mirror_count to only count the AREA_LVs made the function stop working for PVMOVE mirrors. A conditional has been added to fix that problem. Additionally, when counting the images in a mirror stack, we don't need to subtract 1 from the count we get back from the lv_mirror_count call on the temporary mirror layer. (This is because we are no falsely counting the top layer of the temporary mirror.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.167&r2=1.168

lib/metadata/mirror.c +5 -1
@@ -114,13 +114,17 @@
 		return 1;
 
 	seg = first_seg(lv);
+
+	if (lv->status & PVMOVE)
+		return seg->area_count;
+
 	mirrors = 0;
 
 	for (s = 0; s < seg->area_count; s++) {
 		if (seg_type(seg, s) != AREA_LV)
 			continue;
 		if (is_temporary_mirror_layer(seg_lv(seg, s)))
-			mirrors += lv_mirror_count(seg_lv(seg, s)) - 1;
+			mirrors += lv_mirror_count(seg_lv(seg, s));
 		else
 			mirrors++;
 	}