Commit bcb123ac authored by Kemeng Shi's avatar Kemeng Shi Committed by Theodore Ts'o

ext4: return found group directly in ext4_mb_choose_next_group_best_avail

Return good group when it's found in loop to remove futher check if good
group is found after loop.
Signed-off-by: default avatarKemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: default avatarRitesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230801143204.2284343-10-shikemeng@huaweicloud.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent b50675a4
...@@ -1042,18 +1042,16 @@ static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context ...@@ -1042,18 +1042,16 @@ static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context
ac->ac_g_ex.fe_len); ac->ac_g_ex.fe_len);
grp = ext4_mb_find_good_group_avg_frag_lists(ac, frag_order); grp = ext4_mb_find_good_group_avg_frag_lists(ac, frag_order);
if (grp) if (grp) {
break; *group = grp->bb_group;
ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED;
return;
}
} }
if (grp) { /* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */
*group = grp->bb_group; ac->ac_g_ex.fe_len = ac->ac_orig_goal_len;
ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED; *new_cr = CR_GOAL_LEN_SLOW;
} else {
/* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */
ac->ac_g_ex.fe_len = ac->ac_orig_goal_len;
*new_cr = CR_GOAL_LEN_SLOW;
}
} }
static inline int should_optimize_scan(struct ext4_allocation_context *ac) static inline int should_optimize_scan(struct ext4_allocation_context *ac)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment