From: Lukas Czerner <lczerner@redhat.com>
To: Michael Wu <michael@allwinnertech.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
allwinner-opensource-support@allwinnertech.com
Subject: Re: [PATCH] ext4: fix error when itable blocks is greater than s_itb_per_group
Date: Wed, 3 Aug 2022 09:18:59 +0200 [thread overview]
Message-ID: <20220803071859.elywnni2yfol4bea@fedora> (raw)
In-Reply-To: <20220802021029.16046-1-michael@allwinnertech.com>
On Tue, Aug 02, 2022 at 10:10:29AM +0800, Michael Wu wrote:
> The following error occurs when mounting the ext4 image made by image
> making tool:
> "ext4_init_inode_table:1301:comm ext4lazyinit:Something is wrong with group
> 0: used itable blocks: 491; itable unused count: 0."
>
> Currently all the inodes in block group0 and ext4 image is divided by
> s_inodes_per_group. That leads to a hazard: we can't ensure all
> s_inodes_per_group are divisible by s_inodes_per_block. For example, when
> the s_inodes_per_group (equals to 7851) is divided by s_inodes_per_block
> (which is 16), because 7851 is undivisible by 16, we get the wrong result
> 490, while 491 is expected.
>
> So, we suggest that s_itb_per_group should equal to
> DIV_ROUND_UP(s_inodes_per_group, s_inodes_per_block) instead of directly
> getting the result from s_inodes_per_group/s_inodes_per_block.
Hi Michael,
mke2fs is making sure that we completely fill the inote table blocks.
This is a corrupted image and so AFAICT ext4 is doing the right thing
here. There does not seem to be a problem to fix, unless you can somehow
trick mke2fs to make a file system like this.
-Lukas
>
> Signed-off-by: Michael Wu <michael@allwinnertech.com>
> ---
> fs/ext4/super.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 845f2f8aee5f..76cbd638ea10 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4796,8 +4796,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
> sbi->s_inodes_per_group);
> goto failed_mount;
> }
> - sbi->s_itb_per_group = sbi->s_inodes_per_group /
> - sbi->s_inodes_per_block;
> + sbi->s_itb_per_group = DIV_ROUND_UP(sbi->s_inodes_per_group,
> + sbi->s_inodes_per_block);
> sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
> sbi->s_sbh = bh;
> sbi->s_mount_state = le16_to_cpu(es->s_state) & ~EXT4_FC_REPLAY;
> --
> 2.29.0
>
next prev parent reply other threads:[~2022-08-03 7:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 2:10 [PATCH] ext4: fix error when itable blocks is greater than s_itb_per_group Michael Wu
2022-08-03 7:18 ` Lukas Czerner [this message]
2022-08-04 2:19 ` Theodore Ts'o
2022-08-06 4:02 ` Michael Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220803071859.elywnni2yfol4bea@fedora \
--to=lczerner@redhat.com \
--cc=adilger.kernel@dilger.ca \
--cc=allwinner-opensource-support@allwinnertech.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@allwinnertech.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox