Blame SOURCES/bz1059443-1-gfs2_edit_Convert_fssize_to_bytes_before_reporting_fs_size.patch

903fa7
commit 979c86c6e76aa6a879c2a163f8d20653a4a759da
903fa7
Author: Andrew Price <anprice@redhat.com>
903fa7
Date:   Fri Jan 31 06:30:00 2014 -0600
903fa7
903fa7
    gfs2_edit: Convert fssize to bytes before reporting fs size
903fa7
    
903fa7
    gfs2_edit savemeta wasn't converting sbd.fssize to bytes before converting it
903fa7
    to a human-friendly number. This patch adds that multiplier along with a sanity
903fa7
    test for savemeta/restoremeta.
903fa7
    
903fa7
    Resolves: rhbz#1059443
903fa7
    
903fa7
    Signed-off-by: Andrew Price <anprice@redhat.com>
903fa7
903fa7
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
903fa7
index 986fdbe..b4c85d6 100644
903fa7
--- a/gfs2/edit/savemeta.c
903fa7
+++ b/gfs2/edit/savemeta.c
903fa7
@@ -736,7 +736,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
903fa7
 		gfs1_ri_update(&sbd, 0, &rgcount, 0);
903fa7
 	else
903fa7
 		ri_update(&sbd, 0, &rgcount, &sane);
903fa7
-	printf("Done. File system size: %s\n\n", anthropomorphize(sbd.fssize));
903fa7
+	printf("Done. File system size: %s\n\n", anthropomorphize(sbd.fssize * sbd.bsize));
903fa7
 	fflush(stdout);
903fa7
 
903fa7
 	get_journal_inode_blocks();
903fa7
diff --git a/tests/Makefile.am b/tests/Makefile.am
903fa7
index 616a44e..5f02d3a 100644
903fa7
--- a/tests/Makefile.am
903fa7
+++ b/tests/Makefile.am
903fa7
@@ -41,6 +41,7 @@ TESTSUITE_AT = \
903fa7
 	testsuite.at \
903fa7
 	mkfs.at \
903fa7
 	fsck.at \
903fa7
+	edit.at \
903fa7
 	libgfs2.at
903fa7
 
903fa7
 TESTSUITE = $(srcdir)/testsuite
903fa7
diff --git a/tests/edit.at b/tests/edit.at
903fa7
new file mode 100644
903fa7
index 0000000..014d118
903fa7
--- /dev/null
903fa7
+++ b/tests/edit.at
903fa7
@@ -0,0 +1,15 @@
903fa7
+AT_TESTED([gfs2_edit])
903fa7
+AT_BANNER([gfs2_edit tests])
903fa7
+
903fa7
+AT_SETUP([Savemeta/restoremeta, defaults])
903fa7
+GFS_TGT_REGEN
903fa7
+AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
903fa7
+AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta > savemeta.log], 0, [ignore], [ignore])
903fa7
+AT_CHECK([head -2 savemeta.log], 0, [There are 2621440 blocks of 4096 bytes in the destination device.
903fa7
+Reading resource groups...Done. File system size: 4.1023G
903fa7
+], [ignore])
903fa7
+GFS_TGT_REGEN
903fa7
+AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
903fa7
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
903fa7
+
903fa7
+AT_CLEANUP
903fa7
diff --git a/tests/testsuite.at b/tests/testsuite.at
903fa7
index fc90879..fe781a7 100644
903fa7
--- a/tests/testsuite.at
903fa7
+++ b/tests/testsuite.at
903fa7
@@ -22,4 +22,5 @@ AT_COLOR_TESTS
903fa7
 
903fa7
 m4_include([mkfs.at])
903fa7
 m4_include([fsck.at])
903fa7
+m4_include([edit.at])
903fa7
 m4_include([libgfs2.at])