[Cluster-devel] [PATCH 12/18] libgfs2: Move debugging printf out of build_root()

Andrew Price anprice at redhat.com
Wed Jan 12 19:26:44 UTC 2022


mkfs.gfs2 is the only place it could ever get printed so move it there
instead.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/structures.c | 4 ----
 gfs2/mkfs/main_mkfs.c     | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 6cc0a8dd..7ac38f92 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -450,10 +450,6 @@ int build_root(struct gfs2_sbd *sdp)
 	if (sdp->md.rooti == NULL)
 		return -1;
 
-	if (cfg_debug) {
-		printf("\nRoot directory:\n");
-		lgfs2_dinode_print(bh->b_data);
-	}
 	sdp->md.rooti->bh_owned = 1;
 	return 0;
 }
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 56a3b7d2..9a73ff7b 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -1343,6 +1343,10 @@ int main(int argc, char *argv[])
 		printf("%s", _("Done\n"));
 
 	build_root(&sbd);
+	if (opts.debug) {
+		printf("\nRoot directory:\n");
+		lgfs2_dinode_print(sbd.md.rooti->i_bh->b_data);
+	}
 	sbd.sd_root_dir = sbd.md.rooti->i_num;
 
 	strncpy(sbd.sd_lockproto, opts.lockproto, GFS2_LOCKNAME_LEN - 1);
-- 
2.34.1




More information about the Cluster-devel mailing list