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

[Cluster-devel] [PATCH 1/2] gfs2_edit: Convert fssize to bytes before reporting fs size



gfs2_edit savemeta wasn't converting sbd.fssize to bytes before converting it
to a human-friendly number. This patch adds that multiplier along with a sanity
test for savemeta/restoremeta.

Signed-off-by: Andrew Price <anprice redhat com>
---
 gfs2/edit/savemeta.c |  2 +-
 tests/Makefile.am    |  1 +
 tests/edit.at        | 15 +++++++++++++++
 tests/testsuite.at   |  1 +
 4 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 tests/edit.at

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 986fdbe..b4c85d6 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -736,7 +736,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
 		gfs1_ri_update(&sbd, 0, &rgcount, 0);
 	else
 		ri_update(&sbd, 0, &rgcount, &sane);
-	printf("Done. File system size: %s\n\n", anthropomorphize(sbd.fssize));
+	printf("Done. File system size: %s\n\n", anthropomorphize(sbd.fssize * sbd.bsize));
 	fflush(stdout);
 
 	get_journal_inode_blocks();
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 616a44e..5f02d3a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,6 +41,7 @@ TESTSUITE_AT = \
 	testsuite.at \
 	mkfs.at \
 	fsck.at \
+	edit.at \
 	libgfs2.at
 
 TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/edit.at b/tests/edit.at
new file mode 100644
index 0000000..014d118
--- /dev/null
+++ b/tests/edit.at
@@ -0,0 +1,15 @@
+AT_TESTED([gfs2_edit])
+AT_BANNER([gfs2_edit tests])
+
+AT_SETUP([Savemeta/restoremeta, defaults])
+GFS_TGT_REGEN
+AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta > savemeta.log], 0, [ignore], [ignore])
+AT_CHECK([head -2 savemeta.log], 0, [There are 2621440 blocks of 4096 bytes in the destination device.
+Reading resource groups...Done. File system size: 4.1023G
+], [ignore])
+GFS_TGT_REGEN
+AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index fc90879..fe781a7 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -22,4 +22,5 @@ AT_COLOR_TESTS
 
 m4_include([mkfs.at])
 m4_include([fsck.at])
+m4_include([edit.at])
 m4_include([libgfs2.at])
-- 
1.8.3.1


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