@@ -2060,7 +2060,15 @@ static int ext4_mb_good_group(struct
/* We only do this if the grp has never been initialized */
if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
- int ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
+ int ret;
+
+ /* cr=0 is a very optimistic search to find large
+ * good chunks almost for free. if buddy data is
+ * not ready, then this optimization makes no sense */
+
+ if (cr == 0)
+ return 0;
+ ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
if (ret)
return ret;
}