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

[lvm-devel] [PATCH 1/2] Turn off MIRROR_IMAGE flag



This patch is a prepartion for the next patch.

In _remove_mirror_images(), if the LV becomes a linear,
the mirror layer is removed.
Since the layer LV is no longer a mirror image,
flags set for mirror image should be turned off.

The next patch will add a call to lv_empty() in
remove_layer_from_lv().
Since lv_empty() works recursively for mirror images,
it is necessary to turn off MIRROR_IMAGE before
remove_layer_from_lv() where we don't want lv_empty()
to work recursively.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
LV removing operation (_lv_reduce() is the core function) automatically
applies recursively for MIRROR_IMAGE sub LVs.
Since remove_layer_from_lv() involves LV removing operation,
the flag MIRROR_IMAGE should be turned off before doing that.

Index: LVM2.work/lib/metadata/mirror.c
===================================================================
--- LVM2.work.orig/lib/metadata/mirror.c
+++ LVM2.work/lib/metadata/mirror.c
@@ -504,6 +504,8 @@ static int _remove_mirror_images(struct 
 	 * to remove the layer. */
 	if (new_area_count == 1 && !is_temporary_mirror_layer(lv)) {
 		lv1 = seg_lv(mirrored_seg, 0);
+		lv1->status &= ~MIRROR_IMAGE;
+		lv1->status |= VISIBLE_LV;
 		detached_log_lv = detach_mirror_log(mirrored_seg);
 		if (!remove_layer_from_lv(lv, lv1))
 			return_0;

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