dumpe2fs: Print the group checksum and the block options in a nicer way

Also add support for printing the ITABLE_ZERO flag

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index f458eae..b0bdd7d 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -118,9 +118,11 @@
 	else
 		bg_flags = 0;
 
-	print_bg_opt(bg_flags, EXT2_BG_INODE_UNINIT, "Inode not init",
+	print_bg_opt(bg_flags, EXT2_BG_INODE_UNINIT, "INODE_UNINIT",
  		     &first);
-	print_bg_opt(bg_flags, EXT2_BG_BLOCK_UNINIT, "Block not init",
+	print_bg_opt(bg_flags, EXT2_BG_BLOCK_UNINIT, "BLOCK_UNINIT",
+ 		     &first);
+	print_bg_opt(bg_flags, EXT2_BG_INODE_ZEROED, "ITABLE_ZEROED",
  		     &first);
 	if (!first)
 		fputc(']', stdout);
@@ -170,6 +172,10 @@
 		print_range(first_block, last_block);
 		fputs(")", stdout);
 		print_bg_opts(fs, i);
+		if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
+			printf(_("  Checksum 0x%04x, unused inodes %d\n"),
+			       fs->group_desc[i].bg_checksum,
+			       fs->group_desc[i].bg_itable_unused);
 		has_super = ((i==0) || super_blk);
 		if (has_super) {
 			printf (_("  %s superblock at "),
diff --git a/tests/filter_dumpe2fs b/tests/filter_dumpe2fs
index 51211f3..daa2c97 100644
--- a/tests/filter_dumpe2fs
+++ b/tests/filter_dumpe2fs
@@ -10,3 +10,4 @@
 /^Maximum mount count:/d
 /Reserved blocks uid:/s/ (user .*)//
 /Reserved blocks gid:/s/ (group .*)//
+/^  Checksum /d
diff --git a/tests/m_lazy/expect.1 b/tests/m_lazy/expect.1
index 901133b..88bd5c6 100644
--- a/tests/m_lazy/expect.1
+++ b/tests/m_lazy/expect.1
@@ -54,103 +54,103 @@
 Default directory hash:   tea
 
 
-Group 0: (Blocks 1-8192)
+Group 0: (Blocks 1-8192) [ITABLE_ZEROED]
   Primary superblock at 1, Group descriptors at 2-2
   Block bitmap at 3 (+2), Inode bitmap at 4 (+3)
   Inode table at 5-260 (+4)
   7919 free blocks, 2037 free inodes, 2 directories
   Free blocks: 274-8192
   Free inodes: 12-2048
-Group 1: (Blocks 8193-16384) [Inode not init, Block not init]
+Group 1: (Blocks 8193-16384) [INODE_UNINIT, BLOCK_UNINIT]
   Backup superblock at 8193, Group descriptors at 8194-8194
   Block bitmap at 8195 (+2), Inode bitmap at 8196 (+3)
   Inode table at 8197-8452 (+4)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 2: (Blocks 16385-24576) [Inode not init, Block not init]
+Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 16385 (+0), Inode bitmap at 16386 (+1)
   Inode table at 16387-16642 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 3: (Blocks 24577-32768) [Inode not init, Block not init]
+Group 3: (Blocks 24577-32768) [INODE_UNINIT, BLOCK_UNINIT]
   Backup superblock at 24577, Group descriptors at 24578-24578
   Block bitmap at 24579 (+2), Inode bitmap at 24580 (+3)
   Inode table at 24581-24836 (+4)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 4: (Blocks 32769-40960) [Inode not init, Block not init]
+Group 4: (Blocks 32769-40960) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 32769 (+0), Inode bitmap at 32770 (+1)
   Inode table at 32771-33026 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 5: (Blocks 40961-49152) [Inode not init, Block not init]
+Group 5: (Blocks 40961-49152) [INODE_UNINIT, BLOCK_UNINIT]
   Backup superblock at 40961, Group descriptors at 40962-40962
   Block bitmap at 40963 (+2), Inode bitmap at 40964 (+3)
   Inode table at 40965-41220 (+4)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 6: (Blocks 49153-57344) [Inode not init, Block not init]
+Group 6: (Blocks 49153-57344) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 49153 (+0), Inode bitmap at 49154 (+1)
   Inode table at 49155-49410 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 7: (Blocks 57345-65536) [Inode not init, Block not init]
+Group 7: (Blocks 57345-65536) [INODE_UNINIT, BLOCK_UNINIT]
   Backup superblock at 57345, Group descriptors at 57346-57346
   Block bitmap at 57347 (+2), Inode bitmap at 57348 (+3)
   Inode table at 57349-57604 (+4)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 8: (Blocks 65537-73728) [Inode not init, Block not init]
+Group 8: (Blocks 65537-73728) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 65537 (+0), Inode bitmap at 65538 (+1)
   Inode table at 65539-65794 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 9: (Blocks 73729-81920) [Inode not init, Block not init]
+Group 9: (Blocks 73729-81920) [INODE_UNINIT, BLOCK_UNINIT]
   Backup superblock at 73729, Group descriptors at 73730-73730
   Block bitmap at 73731 (+2), Inode bitmap at 73732 (+3)
   Inode table at 73733-73988 (+4)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 10: (Blocks 81921-90112) [Inode not init, Block not init]
+Group 10: (Blocks 81921-90112) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 81921 (+0), Inode bitmap at 81922 (+1)
   Inode table at 81923-82178 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 11: (Blocks 90113-98304) [Inode not init, Block not init]
+Group 11: (Blocks 90113-98304) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 90113 (+0), Inode bitmap at 90114 (+1)
   Inode table at 90115-90370 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 12: (Blocks 98305-106496) [Inode not init, Block not init]
+Group 12: (Blocks 98305-106496) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 98305 (+0), Inode bitmap at 98306 (+1)
   Inode table at 98307-98562 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 13: (Blocks 106497-114688) [Inode not init, Block not init]
+Group 13: (Blocks 106497-114688) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 106497 (+0), Inode bitmap at 106498 (+1)
   Inode table at 106499-106754 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 14: (Blocks 114689-122880) [Inode not init, Block not init]
+Group 14: (Blocks 114689-122880) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 114689 (+0), Inode bitmap at 114690 (+1)
   Inode table at 114691-114946 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 15: (Blocks 122881-131071)
+Group 15: (Blocks 122881-131071) [ITABLE_ZEROED]
   Block bitmap at 122881 (+0), Inode bitmap at 122882 (+1)
   Inode table at 122883-123138 (+2)
   7933 free blocks, 2048 free inodes, 0 directories
diff --git a/tests/m_lazy_resize/expect.1 b/tests/m_lazy_resize/expect.1
index e0e459c..b1f6b5e 100644
--- a/tests/m_lazy_resize/expect.1
+++ b/tests/m_lazy_resize/expect.1
@@ -56,7 +56,7 @@
 Default directory hash:   tea
 
 
-Group 0: (Blocks 1-8192)
+Group 0: (Blocks 1-8192) [ITABLE_ZEROED]
   Primary superblock at 1, Group descriptors at 2-2
   Reserved GDT blocks at 3-258
   Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
@@ -64,7 +64,7 @@
   7662 free blocks, 2037 free inodes, 2 directories
   Free blocks: 531-8192
   Free inodes: 12-2048
-Group 1: (Blocks 8193-16384) [Inode not init]
+Group 1: (Blocks 8193-16384) [INODE_UNINIT]
   Backup superblock at 8193, Group descriptors at 8194-8194
   Reserved GDT blocks at 8195-8450
   Block bitmap at 8451 (+258), Inode bitmap at 8452 (+259)
@@ -72,13 +72,13 @@
   7676 free blocks, 0 free inodes, 0 directories
   Free blocks: 8709-16384
   Free inodes: 
-Group 2: (Blocks 16385-24576) [Inode not init, Block not init]
+Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 16385 (+0), Inode bitmap at 16386 (+1)
   Inode table at 16387-16642 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 3: (Blocks 24577-32768) [Inode not init]
+Group 3: (Blocks 24577-32768) [INODE_UNINIT]
   Backup superblock at 24577, Group descriptors at 24578-24578
   Reserved GDT blocks at 24579-24834
   Block bitmap at 24835 (+258), Inode bitmap at 24836 (+259)
@@ -86,13 +86,13 @@
   7676 free blocks, 0 free inodes, 0 directories
   Free blocks: 25093-32768
   Free inodes: 
-Group 4: (Blocks 32769-40960) [Inode not init, Block not init]
+Group 4: (Blocks 32769-40960) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 32769 (+0), Inode bitmap at 32770 (+1)
   Inode table at 32771-33026 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 5: (Blocks 40961-49152) [Inode not init]
+Group 5: (Blocks 40961-49152) [INODE_UNINIT]
   Backup superblock at 40961, Group descriptors at 40962-40962
   Reserved GDT blocks at 40963-41218
   Block bitmap at 41219 (+258), Inode bitmap at 41220 (+259)
@@ -100,13 +100,13 @@
   7676 free blocks, 0 free inodes, 0 directories
   Free blocks: 41477-49152
   Free inodes: 
-Group 6: (Blocks 49153-57344) [Inode not init, Block not init]
+Group 6: (Blocks 49153-57344) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 49153 (+0), Inode bitmap at 49154 (+1)
   Inode table at 49155-49410 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 7: (Blocks 57345-65536) [Inode not init]
+Group 7: (Blocks 57345-65536) [INODE_UNINIT]
   Backup superblock at 57345, Group descriptors at 57346-57346
   Reserved GDT blocks at 57347-57602
   Block bitmap at 57603 (+258), Inode bitmap at 57604 (+259)
@@ -114,13 +114,13 @@
   7676 free blocks, 0 free inodes, 0 directories
   Free blocks: 57861-65536
   Free inodes: 
-Group 8: (Blocks 65537-73728) [Inode not init, Block not init]
+Group 8: (Blocks 65537-73728) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 65537 (+0), Inode bitmap at 65538 (+1)
   Inode table at 65539-65794 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 9: (Blocks 73729-81920) [Inode not init]
+Group 9: (Blocks 73729-81920) [INODE_UNINIT]
   Backup superblock at 73729, Group descriptors at 73730-73730
   Reserved GDT blocks at 73731-73986
   Block bitmap at 73987 (+258), Inode bitmap at 73988 (+259)
@@ -128,37 +128,37 @@
   7676 free blocks, 0 free inodes, 0 directories
   Free blocks: 74245-81920
   Free inodes: 
-Group 10: (Blocks 81921-90112) [Inode not init, Block not init]
+Group 10: (Blocks 81921-90112) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 81921 (+0), Inode bitmap at 81922 (+1)
   Inode table at 81923-82178 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 11: (Blocks 90113-98304) [Inode not init, Block not init]
+Group 11: (Blocks 90113-98304) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 90113 (+0), Inode bitmap at 90114 (+1)
   Inode table at 90115-90370 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 12: (Blocks 98305-106496) [Inode not init, Block not init]
+Group 12: (Blocks 98305-106496) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 98305 (+0), Inode bitmap at 98306 (+1)
   Inode table at 98307-98562 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 13: (Blocks 106497-114688) [Inode not init, Block not init]
+Group 13: (Blocks 106497-114688) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 106497 (+0), Inode bitmap at 106498 (+1)
   Inode table at 106499-106754 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 14: (Blocks 114689-122880) [Inode not init, Block not init]
+Group 14: (Blocks 114689-122880) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap at 114689 (+0), Inode bitmap at 114690 (+1)
   Inode table at 114691-114946 (+2)
   0 free blocks, 0 free inodes, 0 directories
   Free blocks: 
   Free inodes: 
-Group 15: (Blocks 122881-131071)
+Group 15: (Blocks 122881-131071) [ITABLE_ZEROED]
   Block bitmap at 122881 (+0), Inode bitmap at 122882 (+1)
   Inode table at 122883-123138 (+2)
   7933 free blocks, 2048 free inodes, 0 directories
diff --git a/tests/m_uninit/expect.1 b/tests/m_uninit/expect.1
index 8d19a40..93cea7b 100644
--- a/tests/m_uninit/expect.1
+++ b/tests/m_uninit/expect.1
@@ -56,7 +56,7 @@
 Default directory hash:   tea
 
 
-Group 0: (Blocks 1-8192)
+Group 0: (Blocks 1-8192) [ITABLE_ZEROED]
   Primary superblock at 1, Group descriptors at 2-2
   Reserved GDT blocks at 3-258
   Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
@@ -64,7 +64,7 @@
   7662 free blocks, 2037 free inodes, 2 directories, 2037 unused inodes
   Free blocks: 531-8192
   Free inodes: 12-2048
-Group 1: (Blocks 8193-16384) [Inode not init]
+Group 1: (Blocks 8193-16384) [INODE_UNINIT, ITABLE_ZEROED]
   Backup superblock at 8193, Group descriptors at 8194-8194
   Reserved GDT blocks at 8195-8450
   Block bitmap at 8451 (+258), Inode bitmap at 8452 (+259)
@@ -72,13 +72,13 @@
   7676 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 8709-16384
   Free inodes: 
-Group 2: (Blocks 16385-24576) [Inode not init, Block not init]
+Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 16385 (+0), Inode bitmap at 16386 (+1)
   Inode table at 16387-16642 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 3: (Blocks 24577-32768) [Inode not init]
+Group 3: (Blocks 24577-32768) [INODE_UNINIT, ITABLE_ZEROED]
   Backup superblock at 24577, Group descriptors at 24578-24578
   Reserved GDT blocks at 24579-24834
   Block bitmap at 24835 (+258), Inode bitmap at 24836 (+259)
@@ -86,13 +86,13 @@
   7676 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 25093-32768
   Free inodes: 
-Group 4: (Blocks 32769-40960) [Inode not init, Block not init]
+Group 4: (Blocks 32769-40960) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 32769 (+0), Inode bitmap at 32770 (+1)
   Inode table at 32771-33026 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 5: (Blocks 40961-49152) [Inode not init]
+Group 5: (Blocks 40961-49152) [INODE_UNINIT, ITABLE_ZEROED]
   Backup superblock at 40961, Group descriptors at 40962-40962
   Reserved GDT blocks at 40963-41218
   Block bitmap at 41219 (+258), Inode bitmap at 41220 (+259)
@@ -100,13 +100,13 @@
   7676 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 41477-49152
   Free inodes: 
-Group 6: (Blocks 49153-57344) [Inode not init, Block not init]
+Group 6: (Blocks 49153-57344) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 49153 (+0), Inode bitmap at 49154 (+1)
   Inode table at 49155-49410 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 7: (Blocks 57345-65536) [Inode not init]
+Group 7: (Blocks 57345-65536) [INODE_UNINIT, ITABLE_ZEROED]
   Backup superblock at 57345, Group descriptors at 57346-57346
   Reserved GDT blocks at 57347-57602
   Block bitmap at 57603 (+258), Inode bitmap at 57604 (+259)
@@ -114,13 +114,13 @@
   7676 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 57861-65536
   Free inodes: 
-Group 8: (Blocks 65537-73728) [Inode not init, Block not init]
+Group 8: (Blocks 65537-73728) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 65537 (+0), Inode bitmap at 65538 (+1)
   Inode table at 65539-65794 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 9: (Blocks 73729-81920) [Inode not init]
+Group 9: (Blocks 73729-81920) [INODE_UNINIT, ITABLE_ZEROED]
   Backup superblock at 73729, Group descriptors at 73730-73730
   Reserved GDT blocks at 73731-73986
   Block bitmap at 73987 (+258), Inode bitmap at 73988 (+259)
@@ -128,37 +128,37 @@
   7676 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 74245-81920
   Free inodes: 
-Group 10: (Blocks 81921-90112) [Inode not init, Block not init]
+Group 10: (Blocks 81921-90112) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 81921 (+0), Inode bitmap at 81922 (+1)
   Inode table at 81923-82178 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 11: (Blocks 90113-98304) [Inode not init, Block not init]
+Group 11: (Blocks 90113-98304) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 90113 (+0), Inode bitmap at 90114 (+1)
   Inode table at 90115-90370 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 12: (Blocks 98305-106496) [Inode not init, Block not init]
+Group 12: (Blocks 98305-106496) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 98305 (+0), Inode bitmap at 98306 (+1)
   Inode table at 98307-98562 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 13: (Blocks 106497-114688) [Inode not init, Block not init]
+Group 13: (Blocks 106497-114688) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 106497 (+0), Inode bitmap at 106498 (+1)
   Inode table at 106499-106754 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 14: (Blocks 114689-122880) [Inode not init, Block not init]
+Group 14: (Blocks 114689-122880) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
   Block bitmap at 114689 (+0), Inode bitmap at 114690 (+1)
   Inode table at 114691-114946 (+2)
   7934 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
   Free blocks: 
   Free inodes: 
-Group 15: (Blocks 122881-131071) [Inode not init]
+Group 15: (Blocks 122881-131071) [INODE_UNINIT, ITABLE_ZEROED]
   Block bitmap at 122881 (+0), Inode bitmap at 122882 (+1)
   Inode table at 122883-123138 (+2)
   7933 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes