From: Robin Dong <[email protected]>
When using dumpe2fs to display group detail of a bigalloc-fs, it displays like:
Group 413: (Blocks 54132737-54263808)
Block bitmap at 54132737 (+0), Inode bitmap at 54132738 (+1)
Inode table at 54132739-54133761 (+2)
8127 free blocks, 8184 free inodes, 0 directories
Free blocks: 54133776-54263792
Free inodes: 3379993-3388176
The "8127 free blocks" should be "8127 free clusters".
This patch is based on "next" branch of e2fsprogs.
Signed-off-by: Robin Dong <[email protected]>
---
misc/dumpe2fs.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 9a0dd46..bb4eef1 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -226,12 +226,21 @@ 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, "
- "%u directories%s"),
- ext2fs_bg_free_blocks_count(fs, i),
- ext2fs_bg_free_inodes_count(fs, i),
- ext2fs_bg_used_dirs_count(fs, i),
- ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
+ if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_RO_COMPAT_BIGALLOC))
+ printf (_("\n %u free clusters, %u free inodes, "
+ "%u directories%s"),
+ ext2fs_bg_free_blocks_count(fs, i),
+ ext2fs_bg_free_inodes_count(fs, i),
+ ext2fs_bg_used_dirs_count(fs, i),
+ ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
+ else
+ printf (_("\n %u free blocks, %u free inodes, "
+ "%u directories%s"),
+ ext2fs_bg_free_blocks_count(fs, i),
+ ext2fs_bg_free_inodes_count(fs, i),
+ ext2fs_bg_used_dirs_count(fs, i),
+ ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
if (ext2fs_bg_itable_unused(fs, i))
printf (_(", %u unused inodes\n"),
ext2fs_bg_itable_unused(fs, i));
--
1.7.3.2
From: Robin Dong <[email protected]>
After mke2fs with 1024 block size:
#misc/mke2fs -m 0 -O ^resize_inode,extent,meta_bg,bigalloc -b 1024 /dev/sda
kernel reports:
[74687.352702] EXT4-fs (loop0): ext4_check_descriptors: Inode bitmap for group 0 not in group (block 524288)!
[74687.355534] EXT4-fs (loop0): group descriptors corrupted!
when mount /dev/sda.
The reason is mke2fs set s_first_data_block to 0 by mistake just because
s_log_cluster_size is 4 when s_log_block_size==0.
This patch is based on "next" branch of e2fsprogs.
Signed-off-by: Robin Dong <[email protected]>
---
lib/ext2fs/initialize.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index ccc2dee..c2344a0 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -155,7 +155,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
} else
super->s_log_cluster_size = super->s_log_block_size;
- set_field(s_first_data_block, super->s_log_cluster_size ? 0 : 1);
+ set_field(s_first_data_block, super->s_log_block_size ? 0 : 1);
set_field(s_max_mnt_count, 0);
set_field(s_errors, EXT2_ERRORS_DEFAULT);
set_field(s_feature_compat, 0);
--
1.7.3.2
On 2011-08-04, at 10:27 PM, Robin Dong wrote:
> From: Robin Dong <[email protected]>
>
> When using dumpe2fs to display group detail of a bigalloc-fs, it displays like:
>
> Group 413: (Blocks 54132737-54263808)
> Block bitmap at 54132737 (+0), Inode bitmap at 54132738 (+1)
> Inode table at 54132739-54133761 (+2)
> 8127 free blocks, 8184 free inodes, 0 directories
> Free blocks: 54133776-54263792
> Free inodes: 3379993-3388176
>
> The "8127 free blocks" should be "8127 free clusters".
Perhaps it is good to show both the free clusters and the equivalent free blocks, or maybe even free kB, since having units of e.g. 64kB clusters is hard to understand.
> This patch is based on "next" branch of e2fsprogs.
>
> Signed-off-by: Robin Dong <[email protected]>
> ---
> misc/dumpe2fs.c | 21 +++++++++++++++------
> 1 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
> index 9a0dd46..bb4eef1 100644
> --- a/misc/dumpe2fs.c
> +++ b/misc/dumpe2fs.c
> @@ -226,12 +226,21 @@ 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, "
> - "%u directories%s"),
> - ext2fs_bg_free_blocks_count(fs, i),
> - ext2fs_bg_free_inodes_count(fs, i),
> - ext2fs_bg_used_dirs_count(fs, i),
> - ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
> + if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
> + EXT4_FEATURE_RO_COMPAT_BIGALLOC))
> + printf (_("\n %u free clusters, %u free inodes, "
> + "%u directories%s"),
> + ext2fs_bg_free_blocks_count(fs, i),
> + ext2fs_bg_free_inodes_count(fs, i),
> + ext2fs_bg_used_dirs_count(fs, i),
> + ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
> + else
> + printf (_("\n %u free blocks, %u free inodes, "
> + "%u directories%s"),
> + ext2fs_bg_free_blocks_count(fs, i),
> + ext2fs_bg_free_inodes_count(fs, i),
> + ext2fs_bg_used_dirs_count(fs, i),
> + ext2fs_bg_itable_unused(fs, i) ? "" : "\n");
> if (ext2fs_bg_itable_unused(fs, i))
> printf (_(", %u unused inodes\n"),
> ext2fs_bg_itable_unused(fs, i));
> --
> 1.7.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
On Fri, Aug 05, 2011 at 12:27:51PM +0800, Robin Dong wrote:
> From: Robin Dong <[email protected]>
>
> After mke2fs with 1024 block size:
>
> #misc/mke2fs -m 0 -O ^resize_inode,extent,meta_bg,bigalloc -b 1024 /dev/sda
>
> kernel reports:
>
> [74687.352702] EXT4-fs (loop0): ext4_check_descriptors: Inode bitmap for group 0 not in group (block 524288)!
> [74687.355534] EXT4-fs (loop0): group descriptors corrupted!
>
> when mount /dev/sda.
Wow, out of curiosity, why are you using a 1k block size?
Actually, the bug here is in the kernel (in complaining), not in
e2fsprogs. The only time we want s_first_data_block to be 1 is in the
case when block size and cluster is 1024.
In the case where the cluster is greater than 1k, we want to keep the
clusters aligned (for efficiency with 4k blocksize disks if for no
other reason). Since the superblock is located at a 1k offset,
cluster #0 will always be reserved, so the first 1k is already
reserved for use by the bootloader.
- Ted