From: "Theodore Ts'o" <tytso@mit.edu>
To: Wang Jianjian <wangjianjian0@foxmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Add correct group descriptors and reserved GDT blocks to system zone
Date: Sat, 3 Jun 2023 23:45:59 -0400 [thread overview]
Message-ID: <20230604034559.GG1128744@mit.edu> (raw)
In-Reply-To: <tencent_4A474CC049B9E77D0F172468991EED5B9105@qq.com>
> diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> index 5504f72bbbbe..5df357763975 100644
> --- a/fs/ext4/block_validity.c
> +++ b/fs/ext4/block_validity.c
> @@ -224,11 +223,14 @@ int ext4_setup_system_zone(struct super_block *sb)
>
> for (i=0; i < ngroups; i++) {
> cond_resched();
> - if (ext4_bg_has_super(sb, i) &&
> - ((i < 5) || ((i % flex_size) == 0))) {
> + unsigned int sb_num = ext4_bg_has_super(sb, i);
> + unsigned long gdb_num = ext4_bg_num_gdb(sb, i);
> + unsigned int rsvd_gdt = le16_to_cpu(sbi->es->s_reserved_gdt_blocks);
> +
> + if (sb_num != 0 || gdb_num != 0) {
> ret = add_system_zone(system_blks,
> ext4_group_first_block_no(sb, i),
> - ext4_bg_num_gdb(sb, i) + 1, 0);
> + sb_num + gdb_num + rsvd_gdt, 0);
> if (ret)
> goto err;
> }
How the reserved GDT blocks should be added to the system zone are not
handled correctly in this patch. It can't be unconditionally added to
all block groups.
See the logic in ext4_num_base_meta_clusters() in fs/ext4/balloc.c ---
without the EXT4_NUM_B2C() at the end of the function, since the
system zone tracking is done at the block level, not the cluster
level.
- Ted
next prev parent reply other threads:[~2023-06-04 3:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 16:33 [PATCH] ext4: Add correct group descriptors and reserved GDT blocks to system zone Wang Jianjian
2023-06-03 17:59 ` kernel test robot
2023-06-03 18:10 ` kernel test robot
2023-06-04 3:45 ` Theodore Ts'o [this message]
2023-08-02 16:29 ` Wang Jianjian
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=20230604034559.GG1128744@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=wangjianjian0@foxmail.com \
/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;
as well as URLs for NNTP newsgroup(s).