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

[lvm-devel] [PATCH lvconvert 5/11] Don't insert temporary layer for corelog mirror



lvconvert inserts a temporary layer so that it can sync newly added
mirrors while keeping the original mirror in-sync.
However, LVM2 manages in-sync status for corelog mirror by
the global _mirror_in_sync variable.
So the insertion just duplicates the sync effort.

If the original mirror is corelog, we can just add mimage LV to it
and restart sync.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Mirrored LV with corelog needs resync for every activation
and needs for resync is controlled by the global _mirror_in_sync variable.
So using the temporary sync layer just doubles the effort of syncing
and makes no sense.

Example (without this patch):

(1) Start from in-sync corelog mirror

    # lvs -a
      LV               VG   Attr   LSize Origin Snap%  Move Log Copy% 
      lvol0            vg   mwi-a- 1.00G                        100.00
      [lvol0_mimage_0] vg   iwi-ao 1.00G                              
      [lvol0_mimage_1] vg   iwi-ao 1.00G                              

(2) Add a mirror

    # lvconvert -m+1 --corelog -b vg/lvol0

(3) After the internal suspend/resume process, the in-sync status of
    the original LV is reset and 2 sync processes run parallelly.

    # lvs -a
      LV                  VG   Attr   LSize Origin Snap%  Move Log Copy% 
      lvol0               vg   mwi-a- 1.00G                          9.77
      [lvol0_mimage_0]    vg   Iwi-ao 1.00G                              
      [lvol0_mimage_1]    vg   Iwi-ao 1.00G                              
      [lvol0_mimage_2]    vg   Iwi-ao 1.00G                              
      [lvol0_mimagetmp_2] vg   mwi-ao 1.00G                         10.74
    ...

Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -515,7 +515,9 @@ static int lvconvert_mirrors(struct cmd_
 		}
 		/* FIXME: can't have multiple mlogs. force corelog. */
 		corelog = 1;
-		if (!_insert_lvconvert_layer(cmd, lv)) {
+		/* Insert a temporary layer for syncing,
+		 * only if the original lv is using disk log. */
+		if (seg->log_lv && !_insert_lvconvert_layer(cmd, lv)) {
 			log_error("Failed to insert resync layer");
 			return 0;
 		}

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