Linux-ext4 Archive mirror
 help / color / mirror / Atom feed
From: Wang Jianjian <wangjianjian0@foxmail.com>
To: linux-ext4@vger.kernel.org
Cc: Wang Jianjian <wangjianjian0@foxmail.com>
Subject: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
Date: Thu,  3 Aug 2023 00:28:40 +0800	[thread overview]
Message-ID: <tencent_D744D1450CC169AEA77FCF0A64719909ED05@qq.com> (raw)
In-Reply-To: <20230802162840.331385-1-wangjianjian0@foxmail.com>

When setup_system_zone, flex_bg is not initialzied so it is always 1.
ext4_num_base_meta_blocks() returns the meta blocks in this group
including reserved GDT blocks, so let's use this helper.

Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
---
 fs/ext4/block_validity.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 5504f72bbbbe..558e487a0b53 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -215,7 +215,6 @@ int ext4_setup_system_zone(struct super_block *sb)
 	struct ext4_system_blocks *system_blks;
 	struct ext4_group_desc *gdp;
 	ext4_group_t i;
-	int flex_size = ext4_flex_bg_size(sbi);
 	int ret;
 
 	system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
@@ -224,11 +223,11 @@ 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 meta_blks = ext4_num_base_meta_blocks(sb, i);
+		if (meta_blks != 0) {
 			ret = add_system_zone(system_blks,
 					ext4_group_first_block_no(sb, i),
-					ext4_bg_num_gdb(sb, i) + 1, 0);
+					meta_blks, 0);
 			if (ret)
 				goto err;
 		}
-- 
2.34.3


       reply	other threads:[~2023-08-02 16:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230802162840.331385-1-wangjianjian0@foxmail.com>
2023-08-02 16:28 ` Wang Jianjian [this message]
2023-08-16 15:27   ` [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone Wang Jianjian
2023-08-17 17:05   ` Theodore Ts'o
2024-04-01 14:23     ` Luis Henriques
2024-04-07 10:13       ` wangjianjian (C)
2024-04-10  8:36         ` Luis Henriques

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=tencent_D744D1450CC169AEA77FCF0A64719909ED05@qq.com \
    --to=wangjianjian0@foxmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).