[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lvm-devel
Subject:    [lvm-devel] [PATCH mirror 12/13] Allow renaming of mirrored LV with temporary layer
From:       "Jun'ichi Nomura" <j-nomura () ce ! jp ! nec ! com>
Date:       2007-11-22 2:09:54
Message-ID: 4744E4F2.5040602 () ce ! jp ! nec ! com
[Download RAW message or body]

_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


["lvm2-stacked-mirror-rename.patch" (text/x-patch)]

_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;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic