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

[lvm-devel] [PATCH] make vg_mark_partial_lvs more robust and export it



Hi,

the following patch makes vg_mark_partial_lvs also clear existing
PARTIAL_LV flags, so it can be issued repeatedly on the same VG, keeping
the PARTIAL_LV flags up to date.

This will be useful in a vgreduce --removemissing --force refactor
later.

The patch is simple and straightforward.

Yours,
   Petr

Index: lib/metadata/metadata-exported.h
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/metadata/metadata-exported.h,v
retrieving revision 1.174
diff -u -p -r1.174 metadata-exported.h
--- lib/metadata/metadata-exported.h	12 Jan 2011 20:42:51 -0000	1.174
+++ lib/metadata/metadata-exported.h	16 Feb 2011 08:35:18 -0000
@@ -721,6 +721,8 @@ int vg_check_write_mode(struct volume_gr
 int lv_has_unknown_segments(const struct logical_volume *lv);
 int vg_has_unknown_segments(const struct volume_group *vg);
 
+int vg_mark_partial_lvs(struct volume_group *vg);
+
 struct vgcreate_params {
 	char *vg_name;
 	uint32_t extent_size;
Index: lib/metadata/metadata.c
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/metadata/metadata.c,v
retrieving revision 1.421
diff -u -p -r1.421 metadata.c
--- lib/metadata/metadata.c	14 Feb 2011 19:27:05 -0000	1.421
+++ lib/metadata/metadata.c	16 Feb 2011 08:35:18 -0000
@@ -2108,14 +2108,15 @@ static int _lv_mark_if_partial(struct lo
  */
 int vg_mark_partial_lvs(struct volume_group *vg)
 {
-	struct logical_volume *lv;
 	struct lv_list *lvl;
 
-	dm_list_iterate_items(lvl, &vg->lvs) {
-		lv = lvl->lv;
-		if (!_lv_mark_if_partial(lv))
+	dm_list_iterate_items(lvl, &vg->lvs)
+		lvl->lv->status &= ~PARTIAL_LV;
+
+	dm_list_iterate_items(lvl, &vg->lvs)
+		if (!_lv_mark_if_partial(lvl->lv))
 			return_0;
-	}
+
 	return 1;
 }
 
Index: lib/metadata/metadata.h
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/metadata/metadata.h,v
retrieving revision 1.228
diff -u -p -r1.228 metadata.h
--- lib/metadata/metadata.h	10 Jan 2011 13:13:43 -0000	1.228
+++ lib/metadata/metadata.h	16 Feb 2011 08:35:18 -0000
@@ -411,7 +411,6 @@ struct id pv_vgid(const struct physical_
 struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name);
 int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
 		 struct physical_volume *pv);
-int vg_mark_partial_lvs(struct volume_group *vg);
 int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton);
 
 uint64_t find_min_mda_size(struct dm_list *mdas);
-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

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