All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs
@ 2011-08-05  4:27 Robin Dong
  2011-08-05  4:27 ` [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize Robin Dong
  2011-08-05  6:35 ` [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Andreas Dilger
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Dong @ 2011-08-05  4:27 UTC (permalink / raw)
  To: linux-ext4; +Cc: Robin Dong

From: Robin Dong <sanbai@taobao.com>

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 <sanbai@taobao.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize
  2011-08-05  4:27 [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Robin Dong
@ 2011-08-05  4:27 ` Robin Dong
  2011-08-11  3:23   ` Ted Ts'o
  2011-08-05  6:35 ` [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Andreas Dilger
  1 sibling, 1 reply; 4+ messages in thread
From: Robin Dong @ 2011-08-05  4:27 UTC (permalink / raw)
  To: linux-ext4; +Cc: Robin Dong

From: Robin Dong <sanbai@taobao.com>

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 <sanbai@taobao.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs
  2011-08-05  4:27 [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Robin Dong
  2011-08-05  4:27 ` [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize Robin Dong
@ 2011-08-05  6:35 ` Andreas Dilger
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2011-08-05  6:35 UTC (permalink / raw)
  To: Robin Dong; +Cc: linux-ext4, Robin Dong

On 2011-08-04, at 10:27 PM, Robin Dong wrote:
> From: Robin Dong <sanbai@taobao.com>
> 
> 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 <sanbai@taobao.com>
> ---
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize
  2011-08-05  4:27 ` [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize Robin Dong
@ 2011-08-11  3:23   ` Ted Ts'o
  0 siblings, 0 replies; 4+ messages in thread
From: Ted Ts'o @ 2011-08-11  3:23 UTC (permalink / raw)
  To: Robin Dong; +Cc: linux-ext4, Robin Dong

On Fri, Aug 05, 2011 at 12:27:51PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai@taobao.com>
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-11  3:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05  4:27 [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Robin Dong
2011-08-05  4:27 ` [PATCH 2/2 bigalloc] e2fsprogs: use s_log_block_size to decide s_first_data_block in ext2fs_initialize Robin Dong
2011-08-11  3:23   ` Ted Ts'o
2011-08-05  6:35 ` [PATCH 1/2 bigalloc] e2fsprogs: change "blocks" to "clusters" in dumpe2fs Andreas Dilger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.