Add support for EXT2_FEATURE_COMPAT_LAZY_BG
This feature is initially intended for testing purposes; it allows an
ext2/ext3 developer to create very large filesystems using sparse files
where most of the block groups are not initialized and so do not require
much disk space. Eventually it could be used as a way of speeding up
mke2fs and e2fsck for large filesystem, but that would be best done by
adding an RO_COMPAT extension to the filesystem to allow the inode table
to be lazily initialized on a per-block basis, instead of being entirely initialized
or entirely unused on a per-blockgroup basis.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 12ef00c..25d52d7 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -266,13 +266,26 @@
fputs("\n", f);
}
+static void print_bg_opts(struct ext2_group_desc *gdp, int mask,
+ const char *str, int *first, FILE *f)
+{
+ if (gdp->bg_flags & mask) {
+ if (*first) {
+ fputs(" [", f);
+ *first = 0;
+ } else
+ fputs(", ", f);
+ fputs(str, f);
+ }
+}
+
void do_show_super_stats(int argc, char *argv[])
{
dgrp_t i;
FILE *out;
struct ext2_group_desc *gdp;
int c, header_only = 0;
- int numdirs = 0;
+ int numdirs = 0, first;
reset_getopt();
while ((c = getopt (argc, argv, "h")) != EOF) {
@@ -302,7 +315,7 @@
}
gdp = ¤t_fs->group_desc[0];
- for (i = 0; i < current_fs->group_desc_count; i++, gdp++)
+ for (i = 0; i < current_fs->group_desc_count; i++, gdp++) {
fprintf(out, " Group %2d: block bitmap at %u, "
"inode bitmap at %u, "
"inode table at %u\n"
@@ -318,6 +331,14 @@
gdp->bg_used_dirs_count,
gdp->bg_used_dirs_count != 1 ? "directories"
: "directory");
+ first = 1;
+ print_bg_opts(gdp, EXT2_BG_INODE_UNINIT, "Inode not init",
+ &first, out);
+ print_bg_opts(gdp, EXT2_BG_BLOCK_UNINIT, "Block not init",
+ &first, out);
+ if (!first)
+ fputs("]\n", out);
+ }
close_pager(out);
return;
print_usage: