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

[lvm-devel] [PATCH] Add verbose log messages for LV stacking



Adding verbose log message for '-vvvv'.

Examples:

When adding a temporary layer for mirror resync:
...
#metadata/lv_manip.c:1861     Creating logical volume lvol1_mimagetmp_2
#metadata/lv_manip.c:2409       Inserting layer lvol1_mimagetmp_2 for lvol1
#metadata/lv_manip.c:346       Stack lvol1:0[0] on LV lvol1_mimagetmp_2:0
#metadata/lv_manip.c:46       Adding lvol1:0 as an user of lvol1_mimagetmp_2
..
#metadata/lv_manip.c:266       Remove lvol1:0[0] from the top of LV lvol1_mimage
tmp_2:0
#metadata/lv_manip.c:72       lvol1:0 is no longer a user of lvol1_mimagetmp_2
#metadata/lv_manip.c:346       Stack lvol1:0[0] on LV lvol1_mimagetmp_2:0
#metadata/lv_manip.c:46       Adding lvol1:0 as an user of lvol1_mimagetmp_2
#metadata/lv_manip.c:346       Stack lvol1:0[1] on LV lvol1_mimage_2:0
#metadata/lv_manip.c:46       Adding lvol1:0 as an user of lvol1_mimage_2
..

Then, removing the temporary layer:
#metadata/mirror.c:456       Reducing mirror set from 2 to 1 image(s) and no log volume.
#metadata/lv_manip.c:266       Remove lvol1:0[1] from the top of LV lvol1_mimage_2:0
#metadata/lv_manip.c:72       lvol1:0 is no longer a user of lvol1_mimage_2
#metadata/lv_manip.c:2336       Removing layer lvol1_mimagetmp_2 for lvol1
#metadata/lv_manip.c:346       Stack lvol1:0[2] on LV lvol1_mimage_2:0
#metadata/lv_manip.c:46       Adding lvol1:0 as an user of lvol1_mimage_2
...

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Index: LVM2.work/lib/metadata/lv_manip.c
===================================================================
--- LVM2.work.orig/lib/metadata/lv_manip.c
+++ LVM2.work/lib/metadata/lv_manip.c
@@ -42,6 +42,9 @@ int add_seg_to_segs_using_this_lv(struct
 		}
 	}
 
+	log_very_verbose("Adding %s:%" PRIu32 " as an user of %s",
+			 seg->lv->name, seg->le, lv->name);
+
 	if (!(sl = dm_pool_zalloc(lv->vg->cmd->mem, sizeof(*sl)))) {
 		log_error("Failed to allocate segment list");
 		return 0;
@@ -63,8 +66,12 @@ int remove_seg_from_segs_using_this_lv(s
 			continue;
 		if (sl->count > 1)
 			sl->count--;
-		else
+		else {
+			log_very_verbose("%s:%" PRIu32 " is no longer a user "
+					 "of %s", seg->lv->name, seg->le,
+					 lv->name);
 			list_del(&sl->list);
+		}
 		return 1;
 	}
 
@@ -253,6 +260,11 @@ void release_lv_segment_area(struct lv_s
 	}
 
 	if (area_reduction == seg->area_len) {
+		log_very_verbose("Remove %s:%" PRIu32 "[%" PRIu32 "] from "
+				 "the top of LV %s:%" PRIu32,
+				 seg->lv->name, seg->le, s,
+				 seg_lv(seg, s)->name, seg_le(seg, s));
+
 		remove_seg_from_segs_using_this_lv(seg_lv(seg, s), seg);
 		seg_lv(seg, s) = NULL;
 		seg_le(seg, s) = 0;
@@ -330,6 +342,9 @@ int set_lv_segment_area_lv(struct lv_seg
 			   struct logical_volume *lv, uint32_t le,
 			   uint32_t flags)
 {
+	log_very_verbose("Stack %s:%" PRIu32 "[%" PRIu32 "] on LV %s:%" PRIu32,
+			 seg->lv->name, seg->le, area_num, lv->name, le);
+
 	seg->areas[area_num].type = AREA_LV;
 	seg_lv(seg, area_num) = lv;
 	seg_le(seg, area_num) = le;
@@ -2179,6 +2194,9 @@ int remove_layers_for_segments(struct cm
 	int lv_changed = 0;
 	struct lv_list *lvl;
 
+	log_very_verbose("Removing layer %s for segments of %s",
+			 layer_lv->name, lv->name);
+
 	/* Find all segments that point at the temporary mirror */
 	list_iterate_items(seg, &lv->segments) {
 		for (s = 0; s < seg->area_count; s++) {
@@ -2315,6 +2333,8 @@ int remove_layer_from_lv(struct logical_
 	struct lv_segment *parent_seg;
 	struct segment_type *segtype;
 
+	log_very_verbose("Removing layer %s for %s", layer_lv->name, lv->name);
+
 	if (!(parent_seg = get_only_segment_using_this_lv(layer_lv))) {
 		log_error("Failed to find layer %s in %s",
 		layer_lv->name, lv->name);
@@ -2571,6 +2591,10 @@ int insert_layer_for_segments_on_pv(stru
 	int lv_used = 0;
 	uint32_t s;
 
+	log_very_verbose("Inserting layer %s for segments of %s on %s",
+			 layer_lv->name, lv_where->name,
+			 pvl ? pv_dev_name(pvl->pv) : "any");
+
 	if (!_align_segment_boundary_to_pe_range(lv_where, pvl))
 		return_0;
 
Index: LVM2.work/lib/metadata/mirror.c
===================================================================
--- LVM2.work.orig/lib/metadata/mirror.c
+++ LVM2.work/lib/metadata/mirror.c
@@ -516,6 +516,8 @@ static int _remove_mirror_images(struct 
 			return 0;
 		}
 	} else if (new_area_count == 0) {
+		log_very_verbose("All mimages of %s are gone", lv->name);
+
 		/* All mirror images are gone.
 		 * It can happen for vgreduce --removemissing. */
 		_remove_mirror_log(mirrored_seg);
@@ -586,6 +588,9 @@ static int _remove_mirror_images(struct 
 	if (removed)
 		*removed = old_area_count - new_area_count;
 
+	log_very_verbose("%" PRIu32 " image(s) removed from %s",
+			 old_area_count - num_removed, lv->name);
+
 	return 1;
 }
 

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