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

[lvm-devel] [PATCH mirror 4/13] lv_rename() to walk down the stacked LV



_for_each_sub_lv() is used by lv_rename() to rename the
underlying LVs. But it currently handles only 1 layer.
Let it work recursively for more stacked LV.

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
@@ -1600,10 +1600,14 @@ 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))
+		for (s = 0; s < seg->area_count; s++) {
+			if (seg_type(seg, s) != AREA_LV)
+				continue;
+			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]