Skip to contentSkip to conversation

LVM2/lib activate/activate.c metadata/mirror.c ...

PATCH [email protected] 1 participant 1 message Jan 16, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-01-16 19:18:51

Modified files:

	lib/activate   : activate.c 
	lib/metadata   : mirror.c 
	lib/mirror     : mirrored.c 

Log message:
allow a mirror to contain only one mimage

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.129&r2=1.130
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48

lib/activate/activate.c +7 -0
@@ -508,6 +508,13 @@
 	struct dev_manager *dm;
 	struct lvinfo info;
 
+	/* If mirrored LV is temporarily shrinked to 1 area (= linear),
+	 * it should be considered in-sync. */
+	if (list_size(&lv->segments) == 1 && first_seg(lv)->area_count == 1) {
+		*percent = 100.0;
+		return 1;
+	}
+
 	if (!activation())
 		return 0;
 
lib/metadata/mirror.c +1 -1
@@ -956,7 +956,7 @@
 	list_iterate_items(seg, &lv_mirr->segments) {
 		denominator += seg->area_len;
 
-		if (seg_is_mirrored(seg))
+		if (seg_is_mirrored(seg) && seg->area_count > 1)
 			numerator += seg->extents_copied;
 		else
 			numerator += seg->area_len;
lib/mirror/mirrored.c +5 -0
@@ -283,6 +283,11 @@
 
 	mirr_state = *target_state;
 
+	/* Mirror segment could have only 1 area temporarily,
+	 * if the segment is under conversion. */
+ 	if (seg->area_count == 1)
+		mirror_status = MIRR_DISABLED;
+
 	/*
 	 * For pvmove, only have one mirror segment RUNNING at once.
 	 * Segments before this are COMPLETED and use 2nd area.