aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-04-29 08:11:12 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-04-29 08:11:12 -0400
commit4ddfef7b41aebbbede73f361cb938800ba3072dc (patch)
treec4d0b722424220a02af393b7be7298e456ba4954 /fs/ext4
parent5cdd7b2d7716a7ed7d6dc7588e2d015f04d46640 (diff)
ext4: reduce mballoc stack usage with noinline_for_stack
mballoc.c is a whole lot of static functions, which gcc seems to really like to inline. With the changes below, on x86, I can at least get from: 432 ext4_mb_new_blocks 240 ext4_mb_free_blocks 208 ext4_mb_discard_group_preallocations 188 ext4_mb_seq_groups_show 164 ext4_mb_init_cache 152 ext4_mb_release_inode_pa 136 ext4_mb_seq_history_show ... to 220 ext4_mb_free_blocks 188 ext4_mb_seq_groups_show 176 ext4_mb_regular_allocator 164 ext4_mb_init_cache 156 ext4_mb_new_blocks 152 ext4_mb_release_inode_pa 136 ext4_mb_seq_history_show 124 ext4_mb_release_group_pa ... which still has some big functions in there, but not 432 bytes! Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 9d57695de746..66e1451f64e7 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1168,8 +1168,9 @@ out:
1168 return err; 1168 return err;
1169} 1169}
1170 1170
1171static int ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, 1171static noinline_for_stack int
1172 struct ext4_buddy *e4b) 1172ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
1173 struct ext4_buddy *e4b)
1173{ 1174{
1174 struct ext4_sb_info *sbi = EXT4_SB(sb); 1175 struct ext4_sb_info *sbi = EXT4_SB(sb);
1175 struct inode *inode = sbi->s_buddy_cache; 1176 struct inode *inode = sbi->s_buddy_cache;
@@ -1965,7 +1966,8 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
1965 return 0; 1966 return 0;
1966} 1967}
1967 1968
1968static int ext4_mb_regular_allocator(struct ext4_allocation_context *ac) 1969static noinline_for_stack int
1970ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
1969{ 1971{
1970 ext4_group_t group; 1972 ext4_group_t group;
1971 ext4_group_t i; 1973 ext4_group_t i;
@@ -2465,7 +2467,8 @@ static void ext4_mb_history_init(struct super_block *sb)
2465 /* if we can't allocate history, then we simple won't use it */ 2467 /* if we can't allocate history, then we simple won't use it */
2466} 2468}
2467 2469
2468static void ext4_mb_store_history(struct ext4_allocation_context *ac) 2470static noinline_for_stack void
2471ext4_mb_store_history(struct ext4_allocation_context *ac)
2469{ 2472{
2470 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); 2473 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
2471 struct ext4_mb_history h; 2474 struct ext4_mb_history h;
@@ -2801,7 +2804,8 @@ int ext4_mb_release(struct super_block *sb)
2801 return 0; 2804 return 0;
2802} 2805}
2803 2806
2804static void ext4_mb_free_committed_blocks(struct super_block *sb) 2807static noinline_for_stack void
2808ext4_mb_free_committed_blocks(struct super_block *sb)
2805{ 2809{
2806 struct ext4_sb_info *sbi = EXT4_SB(sb); 2810 struct ext4_sb_info *sbi = EXT4_SB(sb);
2807 int err; 2811 int err;
@@ -3021,7 +3025,8 @@ void exit_ext4_mballoc(void)
3021 * Check quota and mark choosed space (ac->ac_b_ex) non-free in bitmaps 3025 * Check quota and mark choosed space (ac->ac_b_ex) non-free in bitmaps
3022 * Returns 0 if success or error code 3026 * Returns 0 if success or error code
3023 */ 3027 */
3024static int ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, 3028static noinline_for_stack int
3029ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
3025 handle_t *handle) 3030 handle_t *handle)
3026{ 3031{
3027 struct buffer_head *bitmap_bh = NULL; 3032 struct buffer_head *bitmap_bh = NULL;
@@ -3138,7 +3143,8 @@ static void ext4_mb_normalize_group_request(struct ext4_allocation_context *ac)
3138 * Normalization means making request better in terms of 3143 * Normalization means making request better in terms of
3139 * size and alignment 3144 * size and alignment
3140 */ 3145 */
3141static void ext4_mb_normalize_request(struct ext4_allocation_context *ac, 3146static noinline_for_stack void
3147ext4_mb_normalize_request(struct ext4_allocation_context *ac,
3142 struct ext4_allocation_request *ar) 3148 struct ext4_allocation_request *ar)
3143{ 3149{
3144 int bsbits, max; 3150 int bsbits, max;
@@ -3404,7 +3410,8 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
3404/* 3410/*
3405 * search goal blocks in preallocated space 3411 * search goal blocks in preallocated space
3406 */ 3412 */
3407static int ext4_mb_use_preallocated(struct ext4_allocation_context *ac) 3413static noinline_for_stack int
3414ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3408{ 3415{
3409 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); 3416 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
3410 struct ext4_locality_group *lg; 3417 struct ext4_locality_group *lg;
@@ -3571,7 +3578,8 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
3571/* 3578/*
3572 * creates new preallocated space for given inode 3579 * creates new preallocated space for given inode
3573 */ 3580 */
3574static int ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) 3581static noinline_for_stack int
3582ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
3575{ 3583{
3576 struct super_block *sb = ac->ac_sb; 3584 struct super_block *sb = ac->ac_sb;
3577 struct ext4_prealloc_space *pa; 3585 struct ext4_prealloc_space *pa;
@@ -3658,7 +3666,8 @@ static int ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
3658/* 3666/*
3659 * creates new preallocated space for locality group inodes belongs to 3667 * creates new preallocated space for locality group inodes belongs to
3660 */ 3668 */
3661static int ext4_mb_new_group_pa(struct ext4_allocation_context *ac) 3669static noinline_for_stack int
3670ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
3662{ 3671{
3663 struct super_block *sb = ac->ac_sb; 3672 struct super_block *sb = ac->ac_sb;
3664 struct ext4_locality_group *lg; 3673 struct ext4_locality_group *lg;
@@ -3731,8 +3740,8 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
3731 * the caller MUST hold group/inode locks. 3740 * the caller MUST hold group/inode locks.
3732 * TODO: optimize the case when there are no in-core structures yet 3741 * TODO: optimize the case when there are no in-core structures yet
3733 */ 3742 */
3734static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, 3743static noinline_for_stack int
3735 struct buffer_head *bitmap_bh, 3744ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
3736 struct ext4_prealloc_space *pa) 3745 struct ext4_prealloc_space *pa)
3737{ 3746{
3738 struct ext4_allocation_context *ac; 3747 struct ext4_allocation_context *ac;
@@ -3803,7 +3812,8 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b,
3803 return err; 3812 return err;
3804} 3813}
3805 3814
3806static int ext4_mb_release_group_pa(struct ext4_buddy *e4b, 3815static noinline_for_stack int
3816ext4_mb_release_group_pa(struct ext4_buddy *e4b,
3807 struct ext4_prealloc_space *pa) 3817 struct ext4_prealloc_space *pa)
3808{ 3818{
3809 struct ext4_allocation_context *ac; 3819 struct ext4_allocation_context *ac;
@@ -3845,7 +3855,8 @@ static int ext4_mb_release_group_pa(struct ext4_buddy *e4b,
3845 * - how many do we discard 3855 * - how many do we discard
3846 * 1) how many requested 3856 * 1) how many requested
3847 */ 3857 */
3848static int ext4_mb_discard_group_preallocations(struct super_block *sb, 3858static noinline_for_stack int
3859ext4_mb_discard_group_preallocations(struct super_block *sb,
3849 ext4_group_t group, int needed) 3860 ext4_group_t group, int needed)
3850{ 3861{
3851 struct ext4_group_info *grp = ext4_get_group_info(sb, group); 3862 struct ext4_group_info *grp = ext4_get_group_info(sb, group);
@@ -4167,7 +4178,8 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
4167 mutex_lock(&ac->ac_lg->lg_mutex); 4178 mutex_lock(&ac->ac_lg->lg_mutex);
4168} 4179}
4169 4180
4170static int ext4_mb_initialize_context(struct ext4_allocation_context *ac, 4181static noinline_for_stack int
4182ext4_mb_initialize_context(struct ext4_allocation_context *ac,
4171 struct ext4_allocation_request *ar) 4183 struct ext4_allocation_request *ar)
4172{ 4184{
4173 struct super_block *sb = ar->inode->i_sb; 4185 struct super_block *sb = ar->inode->i_sb;
@@ -4398,7 +4410,8 @@ static void ext4_mb_poll_new_transaction(struct super_block *sb,
4398 ext4_mb_free_committed_blocks(sb); 4410 ext4_mb_free_committed_blocks(sb);
4399} 4411}
4400 4412
4401static int ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, 4413static noinline_for_stack int
4414ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
4402 ext4_group_t group, ext4_grpblk_t block, int count) 4415 ext4_group_t group, ext4_grpblk_t block, int count)
4403{ 4416{
4404 struct ext4_group_info *db = e4b->bd_info; 4417 struct ext4_group_info *db = e4b->bd_info;