Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/snapshot_manip.c

PATCH [email protected] 1 participant 1 message May 13, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2009-05-13 21:25:46

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

Log message:
Fix lv_is_visible to handle virtual origin.

Snapshot is visible if its origin is marked visible, or if the origin is virtual.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1106&r2=1.1107
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.46 - 
 ================================
+  Fix lv_is_visible to handle virtual origin.
   Introduce link_lv_to_vg and unlink_lv_from_vg functions.
   Remove lv_count from VG and use counter function instead.
   Fix snapshot segment import to not use duplicate segments & replace.
lib/metadata/snapshot_manip.c +9 -2
@@ -30,8 +30,15 @@
 
 int lv_is_visible(const struct logical_volume *lv)
 {
-	if (lv_is_cow(lv))
-		return lv_is_visible(find_cow(lv)->lv);
+	if (lv->status & SNAPSHOT)
+		return 0;
+
+	if (lv_is_cow(lv)) {
+		if (lv_is_virtual_origin(origin_from_cow(lv)))
+			return 1;
+
+		return lv_is_visible(origin_from_cow(lv));
+	}
 
 	return lv->status & VISIBLE_LV ? 1 : 0;
 }