Whamcloud - gitweb
LU-12988 ldiskfs: skip non-loaded groups at cr=0/1
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-mballoc-skip-uninit-groups-cr0.patch
1 --- linux-4.18/fs/ext4/mballoc.c        2019-11-28 14:55:26.500545920 +0300
2 +++ linux-4.18/fs/ext4/mballoc.c        2019-11-28 14:53:18.600086008 +0300
3 @@ -2060,7 +2060,15 @@ static int ext4_mb_good_group(struct
4  
5         /* We only do this if the grp has never been initialized */
6         if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
7 -               int ret = ext4_mb_init_group(ac->ac_sb, group);
8 +               int ret;
9 +
10 +               /* cr=0/1 is a very optimistic search to find large
11 +                * good chunks almost for free. if buddy data is
12 +                * not ready, then this optimization makes no sense */
13 +
14 +               if (cr < 2)
15 +                       return 0;
16 +               ret = ext4_mb_init_group(ac->ac_sb, group);
17                 if (ret)
18                         return ret;
19         }