From 87ef6a3f0f978088d882419fd44772723962efbe Mon Sep 17 00:00:00 2001 From: Girish Shilamkar Date: Tue, 4 May 2010 17:06:29 +0530 Subject: [PATCH] b=18456 Patch to reduce group prealloc size, skip groups with little free space. (Patch by Andreas Dilger) i=alex.zhuravlev i=girish --- .../patches/ext3-mballoc3-core.patch | 13 +++++--- .../patches/ext4-mballoc-skip-grps.patch | 38 ++++++++++++++++++++++ .../series/ldiskfs-2.6-rhel5-ext4.series | 1 + .../series/ldiskfs-2.6-sles11.series | 1 + 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 ldiskfs/kernel_patches/patches/ext4-mballoc-skip-grps.patch diff --git a/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch b/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch index 197e8cc..6e87ccc 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mballoc3-core.patch @@ -288,7 +288,7 @@ Index: linux-2.6.22.19/fs/ext3/mballoc.c =================================================================== --- /dev/null +++ linux-2.6.22.19/fs/ext3/mballoc.c -@@ -0,0 +1,4483 @@ +@@ -0,0 +1,4486 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. + * Written by Alex Zhuravlev @@ -2126,9 +2126,12 @@ Index: linux-2.6.22.19/fs/ext3/mballoc.c + if (group == EXT3_SB(sb)->s_groups_count) + group = 0; + -+ /* quick check to skip empty groups */ ++ /* If there's no chance that this group has a better ++ * extent, just skip it instead of seeking to read ++ * block bitmap from disk. Initially ac_b_ex.fe_len = 0, ++ * so this always skips groups with no free space. */ + grp = EXT3_GROUP_INFO(ac->ac_sb, group); -+ if (grp->bb_free == 0) ++ if (grp->bb_free <= ac->ac_b_ex.fe_len) + continue; + + if (EXT3_MB_GRP_NEED_INIT(EXT3_GROUP_INFO(sb, group))) { @@ -2802,7 +2805,7 @@ Index: linux-2.6.22.19/fs/ext3/mballoc.c + + sbi->s_mb_small_req = 256; + sbi->s_mb_large_req = 1024; -+ sbi->s_mb_group_prealloc = 512; ++ sbi->s_mb_group_prealloc = 256; + } else { + sbi->s_mb_prealloc_table_size = 3; + i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long); @@ -2821,7 +2824,7 @@ Index: linux-2.6.22.19/fs/ext3/mballoc.c + + sbi->s_mb_small_req = sbi->s_stripe; + sbi->s_mb_large_req = sbi->s_stripe * 8; -+ sbi->s_mb_group_prealloc = sbi->s_stripe * 4; ++ sbi->s_mb_group_prealloc = sbi->s_stripe; + } + + i = sizeof(struct ext3_locality_group) * num_possible_cpus(); diff --git a/ldiskfs/kernel_patches/patches/ext4-mballoc-skip-grps.patch b/ldiskfs/kernel_patches/patches/ext4-mballoc-skip-grps.patch new file mode 100644 index 0000000..53a1190 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-mballoc-skip-grps.patch @@ -0,0 +1,38 @@ +Index: linux-stage/fs/ext4/mballoc.c +=================================================================== +--- linux-stage.orig/fs/ext4/mballoc.c ++++ linux-stage/fs/ext4/mballoc.c +@@ -2009,9 +2009,13 @@ repeat: + if (group == EXT4_SB(sb)->s_groups_count) + group = 0; + +- /* quick check to skip empty groups */ ++ /* If there's no chance that this group has a better ++ * extent, just skip it instead of seeking to read ++ * block bitmap from disk. Initially ac_b_ex.fe_len = 0, ++ * so this always skips groups with no free space. */ ++ + grp = ext4_get_group_info(sb, group); +- if (grp->bb_free == 0) ++ if (grp->bb_free <= ac->ac_b_ex.fe_len) + continue; + + /* +@@ -2780,7 +2784,7 @@ int ext4_mb_init(struct super_block *sb, + + sbi->s_mb_small_req = 256; + sbi->s_mb_large_req = 1024; +- sbi->s_mb_group_prealloc = 512; ++ sbi->s_mb_group_prealloc = 256; + } else { + sbi->s_mb_prealloc_table_size = 3; + i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long); +@@ -2798,7 +2802,7 @@ int ext4_mb_init(struct super_block *sb, + + sbi->s_mb_small_req = sbi->s_stripe; + sbi->s_mb_large_req = sbi->s_stripe * 8; +- sbi->s_mb_group_prealloc = sbi->s_stripe * 4; ++ sbi->s_mb_group_prealloc = sbi->s_stripe; + } + + sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group); diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series index 53b761d..d920bb1 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series @@ -29,3 +29,4 @@ ext4-ext_generation-sles11.patch ext4-kill-dx_root.patch ext4-extents-mount-option-rhel5.patch ext4-fiemap-2.6-rhel5.patch +ext4-mballoc-skip-grps.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series index bcf9753..909a704 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series @@ -33,3 +33,4 @@ ext4-dynlocks-common-sles11.patch ext4-dynlocks-2.6-rhel5.patch ext4-hash-indexed-dir-dotdot-update.patch ext4-disable-write-bar-by-default.patch +ext4-mballoc-skip-grps.patch -- 1.8.3.1