Whamcloud - gitweb
b=18456 Patch to reduce group prealloc size, skip groups with little free space....
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-mballoc-skip-grps.patch
1 Index: linux-stage/fs/ext4/mballoc.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/mballoc.c
4 +++ linux-stage/fs/ext4/mballoc.c
5 @@ -2009,9 +2009,13 @@ repeat:
6                         if (group == EXT4_SB(sb)->s_groups_count)
7                                 group = 0;
8  
9 -                       /* quick check to skip empty groups */
10 +                       /* If there's no chance that this group has a better
11 +                        * extent, just skip it instead of seeking to read
12 +                        * block bitmap from disk. Initially ac_b_ex.fe_len = 0,
13 +                        * so this always skips groups with no free space. */
14 +
15                         grp = ext4_get_group_info(sb, group);
16 -                       if (grp->bb_free == 0)
17 +                       if (grp->bb_free <= ac->ac_b_ex.fe_len)
18                                 continue;
19  
20                         /*
21 @@ -2780,7 +2784,7 @@ int ext4_mb_init(struct super_block *sb,
22  
23                 sbi->s_mb_small_req = 256;
24                 sbi->s_mb_large_req = 1024;
25 -               sbi->s_mb_group_prealloc = 512;
26 +               sbi->s_mb_group_prealloc = 256;
27         } else {
28                 sbi->s_mb_prealloc_table_size = 3;
29                 i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
30 @@ -2798,7 +2802,7 @@ int ext4_mb_init(struct super_block *sb,
31  
32                 sbi->s_mb_small_req = sbi->s_stripe;
33                 sbi->s_mb_large_req = sbi->s_stripe * 8;
34 -               sbi->s_mb_group_prealloc = sbi->s_stripe * 4;
35 +               sbi->s_mb_group_prealloc = sbi->s_stripe;
36         }
37  
38         sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);