[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH mirror 12/13] Allow renaming of mirrored LV with temporary layer



_for_each_sub_lv() is a function used to execute same function
for each LVs used in a given LV's segments.
It's used for lv_rename() to implement mirrored LV renaming.

When we have temporary layers in mirrored LV, mirrored LV is
no longer flat. So _for_each_sub_lv() should work recursively.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

_for_each_sub_lv() should work recursively to support renaming.

Index: LVM2.work/lib/metadata/lv_manip.c
===================================================================
--- LVM2.work.orig/lib/metadata/lv_manip.c
+++ LVM2.work/lib/metadata/lv_manip.c
@@ -1615,10 +1615,15 @@ static int _for_each_sub_lv(struct cmd_c
 	list_iterate_items(seg, &lv->segments) {
 		if (seg->log_lv && !func(cmd, seg->log_lv, data))
 			return 0;
-		for (s = 0; s < seg->area_count; s++)
-			if (seg_type(seg, s) == AREA_LV &&
-			    !func(cmd, seg_lv(seg, s), data))
-				return 0;
+		for (s = 0; s < seg->area_count; s++) {
+			if (seg_type(seg, s) == AREA_LV) {
+				if (!func(cmd, seg_lv(seg, s), data))
+					return 0;
+				if (!_for_each_sub_lv(cmd, seg_lv(seg, s),
+						      func, data))
+					return 0;
+			}
+		}
 	}
 
 	return 1;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]