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

[lvm-devel] [PATCH lvconvert 8/11] Add internal 'CONVERTING' flag for LVs under conversion



Add 'CONVERTING' flag for LVs under conversion.
Reporting code and daemon restarting code will use it.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Add 'CONVERTING' flag for internal use.

Index: LVM2.work/lib/format_text/import_vsn1.c
===================================================================
--- LVM2.work.orig/lib/format_text/import_vsn1.c
+++ LVM2.work/lib/format_text/import_vsn1.c
@@ -86,6 +86,22 @@ static int _check_version(struct config_
 	return 1;
 }
 
+static int _is_converting(struct logical_volume *lv)
+{
+	struct lv_segment *seg;
+
+	if (lv->status & MIRRORED) {
+		seg = first_seg(lv);
+		/* Can't use is_temporary_mirror() because the metadata for
+		 * seg_lv may not be read in and flags may not be set yet. */
+		if (seg_type(seg, 0) == AREA_LV &&
+		    strstr(seg_lv(seg, 0)->name, MIRROR_SYNC_LAYER))
+			return 1;
+	}
+
+	return 0;
+}
+
 static int _read_id(struct id *id, struct config_node *cn, const char *path)
 {
 	struct config_value *cv;
@@ -343,6 +359,9 @@ static int _read_segment(struct dm_pool 
 	if (seg_is_virtual(seg))
 		lv->status |= VIRTUAL;
 
+	if (_is_converting(lv))
+		lv->status |= CONVERTING;
+
 	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
@@ -69,6 +69,7 @@ struct pv_segment;
 #define MIRROR_NOTSYNCED	0x00080000U	/* LV */
 //#define ACTIVATE_EXCL		0x00100000U	/* LV - internal use only */
 //#define PRECOMMITTED		0x00200000U	/* VG - internal use only */
+#define CONVERTING		0x00400000U	/* LV */
 
 #define LVM_READ              	0x00000100U	/* LV VG */
 #define LVM_WRITE             	0x00000200U	/* LV VG */
Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -270,6 +270,8 @@ static int _finish_lvconvert_mirror(stru
 		return 0;
 	}
 
+	lv->status &= ~CONVERTING;
+
 	log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
 
 	if (!vg_write(vg))
@@ -546,6 +548,7 @@ static int lvconvert_mirrors(struct cmd_
 				    0U, lp->pvh, lp->alloc,
 				    MIRROR_BY_LV))
 			return_0;
+		lv->status |= CONVERTING;
 		lp->wait_daemon = 1;
 	} else {
 		/* Reduce number of mirrors */
Index: LVM2.work/lib/format_text/flags.c
===================================================================
--- LVM2.work.orig/lib/format_text/flags.c
+++ LVM2.work/lib/format_text/flags.c
@@ -60,6 +60,7 @@ static struct flag _lv_flags[] = {
 	{VIRTUAL, NULL},
 	{SNAPSHOT, NULL},
 	{ACTIVATE_EXCL, NULL},
+	{CONVERTING, NULL},
 	{0, NULL}
 };
 

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