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

[Cluster-devel] [PATCH 4/6] libgfs2: Move some debug messages out into mkfs/fsck



We don't need to print these messages from the function which
calculates the resource group layout, we can do it afterwards.
There are still some other messages which need to be relocated
from this function, but that is a more tricky operation.

Signed-off-by: Steven Whitehouse <swhiteho redhat com>
---
 gfs2/fsck/rgrepair.c       |   19 +++++++++++++++++++
 gfs2/libgfs2/fs_geometry.c |   12 ------------
 gfs2/mkfs/gfs2_mkfs.h      |    9 +++++----
 gfs2/mkfs/main_grow.c      |   19 +++++++++++++++++++
 gfs2/mkfs/main_mkfs.c      |    1 +
 5 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 1ffa2c0..c11558b 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -593,6 +593,24 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
 	return 0;
 }
 
+static void debug_print_rgrps(struct gfs2_sbd *sdp, struct osi_root *rgtree)
+{
+	struct osi_node *n, *next;
+	struct rgrp_tree *rl;
+
+	if (sdp->debug) {
+		log_info("\n");
+
+		for (n = osi_first(rgtree); n; n = next) {
+			next = osi_next(n);
+			rl = (struct rgrp_tree *)n;
+			log_info("rg_o = %llu, rg_l = %llu\n",
+				 (unsigned long long)rl->start,
+				 (unsigned long long)rl->length);
+		}
+	}
+}
+
 /*
  * gfs2_rindex_calculate - calculate what the rindex should look like
  *                          in a perfect world (trust_lvl == open_minded)
@@ -643,6 +661,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs)
 	}
 	/* Compute the default resource group layout as mkfs would have done */
 	compute_rgrp_layout(sdp, &sdp->rgcalc, TRUE);
+	debug_print_rgrps(sdp, &sdp->rgcalc);
 	build_rgrps(sdp, FALSE); /* FALSE = calc but don't write to disk. */
 	log_debug( _("fs_total_size = 0x%llx blocks.\n"),
 		  (unsigned long long)sdp->device.length);
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 4278bbf..5ff9813 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -142,18 +142,6 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
 	}
 
 	sdp->rgrps = nrgrp;
-
-	if (sdp->debug) {
-		log_info("\n");
-
-		for (n = osi_first(rgtree); n; n = next) {
-			next = osi_next(n);
-			rl = (struct rgrp_tree *)n;
-			log_info("rg_o = %llu, rg_l = %llu\n",
-				 (unsigned long long)rl->start,
-				 (unsigned long long)rl->length);
-		}
-	}
 }
 
 /**
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index 14bf4f6..6f0ac2b 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -6,16 +6,17 @@
 #include "copyright.cf"
 
 /* main_grow */
-void main_grow(int argc, char *argv[]);
+extern void main_grow(int argc, char *argv[]);
+extern void debug_print_rgrps(struct gfs2_sbd *sdp, struct osi_root *rgtree);
 
 /* main_jadd */
-void main_jadd(int argc, char *argv[]);
+extern void main_jadd(int argc, char *argv[]);
 
 /* main_mkfs */
-void main_mkfs(int argc, char *argv[]);
+extern void main_mkfs(int argc, char *argv[]);
 
 /* main_shrink */
-void main_shrink(int argc, char *argv[]);
+extern void main_shrink(int argc, char *argv[]);
 
 /*
  * The following inode IOCTL macros and inode flags 
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index f6d7bf0..1dc911a 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -284,6 +284,24 @@ static void print_info(struct gfs2_sbd *sdp)
 		   (unsigned long long)fsgrowth / MB);
 }
 
+void debug_print_rgrps(struct gfs2_sbd *sdp, struct osi_root *rgtree)
+{
+	struct osi_node *n, *next;
+	struct rgrp_tree *rl;
+
+	if (sdp->debug) {
+		log_info("\n");
+
+		for (n = osi_first(rgtree); n; n = next) {
+			next = osi_next(n);
+			rl = (struct rgrp_tree *)n;
+			log_info("rg_o = %llu, rg_l = %llu\n",
+				 (unsigned long long)rl->start,
+				 (unsigned long long)rl->length);
+		}
+	}
+}
+
 /**
  * main_grow - do everything
  * @argc:
@@ -391,6 +409,7 @@ main_grow(int argc, char *argv[])
 			int old_rg_count;
 
 			compute_rgrp_layout(sdp, &sdp->rgtree, TRUE);
+			debug_print_rgrps(sdp, &sdp->rgtree);
 			print_info(sdp);
 			initialize_new_portion(sdp, &old_rg_count);
 			fix_rindex(sdp, rindex_fd, old_rg_count);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index eeff47b..700b434 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -629,6 +629,7 @@ void main_mkfs(int argc, char *argv[])
 	/* Compute the resource group layouts */
 
 	compute_rgrp_layout(sdp, &sdp->rgtree, rgsize_specified);
+	debug_print_rgrps(sdp, &sdp->rgtree);
 
 	/* Generate a random uuid */
 	get_random_bytes(uuid, sizeof(uuid));
-- 
1.7.4.4


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