1 Index: kernel-4.18.0-423.el8/fs/ext4/mballoc.c
2 ===================================================================
3 --- kernel-4.18.0-423.el8.orig/fs/ext4/mballoc.c
4 +++ kernel-4.18.0-423.el8/fs/ext4/mballoc.c
5 @@ -1958,6 +1958,21 @@ int ext4_mb_find_by_goal(struct ext4_all
9 +static inline int ext4_mb_uninit_on_disk(struct super_block *sb,
12 + struct ext4_group_desc *desc;
14 + if (!ext4_has_group_desc_csum(sb))
17 + desc = ext4_get_group_desc(sb, group, NULL);
18 + if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))
25 * The routine scans buddy structures (not bitmap!) from given order
26 * to max order and tries to find big enough chunk to satisfy the req
27 @@ -2196,6 +2211,12 @@ static int ext4_mb_good_group_nolock(str
29 /* We only do this if the grp has never been initialized */
30 if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
31 + /* cr=0/1 is a very optimistic search to find large
32 + * good chunks almost for free. if buddy data is
33 + * not ready, then this optimization makes no sense */
35 + if (cr < 2 && !ext4_mb_uninit_on_disk(ac->ac_sb, group))
37 ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);