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

[lvm-devel] [PATCH mirror 2/13] Misc fixes to the 'lvconvert' generalization



This small patch contains misc fixes to the lvconvert generalization
code that has been just committed to CVS.

  - lv_add_mirror_lvs() should turn off VISIBLE_LV flag of
    each mimage LV.
  - 'struct alloc_handle' declaration in metadata-exported.h
    is not needed as create_mirror_layers() was removed.
  - lv_remove_mirrors() should use lv_mirror_count() instead of
    seg->area_count.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Misc changes to lvconvert mirror.
  - lv_add_mirror_lvs() should turn of 'VISIBLE_LV' flag for each
    mimage LV.
  - Declaration of 'struct alloc_handle' in metadata-exported.h
    is no longer needed.
  - lv_remove_mirrors() should use lv_mirror_count(), that can
    cope with stacked mirrors

Index: LVM2.work/lib/metadata/lv_manip.c
===================================================================
--- LVM2.work.orig/lib/metadata/lv_manip.c
+++ LVM2.work/lib/metadata/lv_manip.c
@@ -1407,6 +1407,7 @@ int lv_add_mirror_lvs(struct logical_vol
 	for (m = old_area_count; m < new_area_count; m++) {
 		set_lv_segment_area_lv(seg, m, sub_lvs[m - old_area_count], 0, status);
 		first_seg(sub_lvs[m - old_area_count])->mirror_seg = seg;
+		sub_lvs[m - old_area_count]->status &= ~VISIBLE_LV;
 	}
 
 	return 1;
Index: LVM2.work/lib/metadata/metadata-exported.h
===================================================================
--- LVM2.work.orig/lib/metadata/metadata-exported.h
+++ LVM2.work/lib/metadata/metadata-exported.h
@@ -459,7 +459,6 @@ int lv_remove_mirrors(struct cmd_context
 #define MIRROR_BY_LV	0x00000002U	/* mirror by mimage LVs */
 
 uint32_t lv_mirror_count(const struct logical_volume *lv);
-struct alloc_handle;
 uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
                                     uint32_t region_size);
 int remove_mirrors_from_segments(struct logical_volume *lv,
Index: LVM2.work/lib/metadata/mirror.c
===================================================================
--- LVM2.work.orig/lib/metadata/mirror.c
+++ LVM2.work/lib/metadata/mirror.c
@@ -1195,12 +1195,12 @@ int lv_remove_mirrors(struct cmd_context
 		return 0;
 	}
 
-	if (seg->area_count <= mirrors) {
+	if (lv_mirror_count(lv) <= mirrors) {
 		log_error("Removing more than existing: %d <= %d",
 			  seg->area_count, mirrors);
 		return 0;
 	}
-	new_mirrors = seg->area_count - mirrors - 1;
+	new_mirrors = lv_mirror_count(lv) - mirrors - 1;
 
 	/* MIRROR_BY_LV */
 	if (seg_type(seg, 0) == AREA_LV &&

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