[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <a53fe585-2b31-3a2e-f3eb-edc6f80ad85f@gmail.com>
Date: Fri, 7 Aug 2020 22:01:46 +0800
From: brookxu <brookxu.cn@...il.com>
To: adilger.kernel@...ger.ca, tytso@....edu, linux-ext4@...r.kernel.org
Subject: [PATCH] ext4: put grp related checks into ext4_mb_good_group()
We will make these judgments in ext4_mb_good_group(), maybe there
is no need to repeat judgments here.
Signed-off-by: Chunguang Xu <brookxu@...cent.com>
---
fs/ext4/mballoc.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 4304113..84871f7 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2178,21 +2178,8 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group);
struct super_block *sb = ac->ac_sb;
bool should_lock = ac->ac_flags & EXT4_MB_STRICT_CHECK;
- ext4_grpblk_t free;
int ret = 0;
- if (should_lock)
- ext4_lock_group(sb, group);
- free = grp->bb_free;
- if (free == 0)
- goto out;
- if (cr <= 2 && free < ac->ac_g_ex.fe_len)
- goto out;
- if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(grp)))
- goto out;
- if (should_lock)
- ext4_unlock_group(sb, group);
-
/* We only do this if the grp has never been initialized */
if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
@@ -2202,8 +2189,9 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
if (should_lock)
ext4_lock_group(sb, group);
+
ret = ext4_mb_good_group(ac, group, cr);
-out:
+
if (should_lock)
ext4_unlock_group(sb, group);
return ret;
--
1.8.3.1
Powered by blists - more mailing lists