Whamcloud - gitweb
dumpe2fs: display "free blocks" as "free clusters" for bigalloc file systems
authorTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 14:13:41 +0000 (10:13 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 14:13:41 +0000 (10:13 -0400)
Change this for the equivalent function in debugfs as well.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/debugfs.c
misc/dumpe2fs.c

index e7d7436..4b29260 100644 (file)
@@ -308,6 +308,7 @@ static void print_bg_opts(ext2_filsys fs, dgrp_t group, int mask,
 
 void do_show_super_stats(int argc, char *argv[])
 {
+       const char *units ="block";
        dgrp_t  i;
        FILE    *out;
        int     c, header_only = 0;
@@ -330,6 +331,10 @@ void do_show_super_stats(int argc, char *argv[])
                return;
        out = open_pager();
 
+       if (EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
+                                      EXT4_FEATURE_RO_COMPAT_BIGALLOC))
+               units = "cluster";
+
        list_super2(current_fs->super, out);
        for (i=0; i < current_fs->group_desc_count; i++)
                numdirs += ext2fs_bg_used_dirs_count(current_fs, i);
@@ -346,15 +351,15 @@ void do_show_super_stats(int argc, char *argv[])
                fprintf(out, " Group %2d: block bitmap at %llu, "
                        "inode bitmap at %llu, "
                        "inode table at %llu\n"
-                       "           %u free %s, "
+                       "           %u free %s%s, "
                        "%u free %s, "
                        "%u used %s%s",
                        i, ext2fs_block_bitmap_loc(current_fs, i),
                        ext2fs_inode_bitmap_loc(current_fs, i),
                        ext2fs_inode_table_loc(current_fs, i),
-                       ext2fs_bg_free_blocks_count(current_fs, i),
+                       ext2fs_bg_free_blocks_count(current_fs, i), units,
                        ext2fs_bg_free_blocks_count(current_fs, i) != 1 ?
-                       "blocks" : "block",
+                       "s" : "",
                        ext2fs_bg_free_inodes_count(current_fs, i),
                        ext2fs_bg_free_inodes_count(current_fs, i) != 1 ?
                        "inodes" : "inode",
index 9a0dd46..4d2d5c7 100644 (file)
@@ -148,12 +148,17 @@ static void list_desc (ext2_filsys fs)
        blk64_t first_block, last_block;
        blk64_t super_blk, old_desc_blk, new_desc_blk;
        char *block_bitmap=NULL, *inode_bitmap=NULL;
+       const char *units = _("blocks");
        int inode_blocks_per_group, old_desc_blocks, reserved_gdt;
        int             block_nbytes, inode_nbytes;
        int has_super;
        blk64_t         blk_itr = EXT2FS_B2C(fs, fs->super->s_first_data_block);
        ext2_ino_t      ino_itr = 1;
 
+       if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+                                      EXT4_FEATURE_RO_COMPAT_BIGALLOC))
+               units = _("clusters");
+
        block_nbytes = EXT2_CLUSTERS_PER_GROUP(fs->super) / 8;
        inode_nbytes = EXT2_INODES_PER_GROUP(fs->super) / 8;
 
@@ -226,9 +231,9 @@ static void list_desc (ext2_filsys fs)
                            inode_blocks_per_group - 1);
                print_bg_rel_offset(fs, ext2fs_inode_table_loc(fs, i), 1,
                                    first_block, last_block);
-               printf (_("\n  %u free blocks, %u free inodes, "
+               printf (_("\n  %u free %s, %u free inodes, "
                          "%u directories%s"),
-                       ext2fs_bg_free_blocks_count(fs, i),
+                       ext2fs_bg_free_blocks_count(fs, i), units,
                        ext2fs_bg_free_inodes_count(fs, i),
                        ext2fs_bg_used_dirs_count(fs, i),
                        ext2fs_bg_itable_unused(fs, i) ? "" : "\n");