[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1604764698-4269-4-git-send-email-brookxu@tencent.com>
Date: Sat, 7 Nov 2020 23:58:14 +0800
From: Chunguang Xu <brookxu.cn@...il.com>
To: tytso@....edu, adilger.kernel@...ger.ca
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH RESEND 4/8] ext4: add the gdt block of meta_bg to system_zone
From: Chunguang Xu <brookxu@...cent.com>
In order to avoid poor search efficiency of system_zone, the
system only adds metadata of some sparse group to system_zone.
In the meta_bg scenario, the non-sparse group may contain gdt
blocks. Perhaps we should add these blocks to system_zone to
improve fault tolerance without significantly reducing system
performance.
Signed-off-by: Chunguang Xu <brookxu@...cent.com>
---
fs/ext4/block_validity.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 8e6ca23..37025e3 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -218,6 +218,7 @@ int ext4_setup_system_zone(struct super_block *sb)
struct ext4_group_desc *gdp;
ext4_group_t i;
int flex_size = ext4_flex_bg_size(sbi);
+ int gd_blks;
int ret;
system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
@@ -226,13 +227,16 @@ 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))) {
- ret = add_system_zone(system_blks,
- ext4_group_first_block_no(sb, i),
- ext4_bg_num_gdb(sb, i) + 1, 0);
- if (ret)
- goto err;
+ if ((i < 5) || ((i % flex_size) == 0)) {
+ gd_blks = ext4_bg_has_super(sb, i) +
+ ext4_bg_num_gdb(sb, i);
+ if (gd_blks) {
+ ret = add_system_zone(system_blks,
+ ext4_group_first_block_no(sb, i),
+ gd_blks, 0);
+ if (ret)
+ goto err;
+ }
}
gdp = ext4_get_group_desc(sb, i, NULL);
ret = add_system_zone(system_blks,
--
1.8.3.1
Powered by blists - more mailing lists