diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-03-04 19:09:10 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-03-04 19:09:10 -0500 |
commit | 9f24e4208f7ee2748f157368b63287dc903fcf60 (patch) | |
tree | 255989fe69ebfb2b031dc7cf6dbe975df67c711a /fs/ext4/mballoc.c | |
parent | b713a5ec55bf73c833f9883cdd761b20ee61a1ab (diff) |
ext4: Use atomic_t's in struct flex_groups
Reduce pressure on the sb_bgl_lock family of locks by using atomic_t's
to track the number of free blocks and inodes in each flex_group.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index c4c430977622..e72c72a0b807 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3044,9 +3044,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
3044 | if (sbi->s_log_groups_per_flex) { | 3044 | if (sbi->s_log_groups_per_flex) { |
3045 | ext4_group_t flex_group = ext4_flex_group(sbi, | 3045 | ext4_group_t flex_group = ext4_flex_group(sbi, |
3046 | ac->ac_b_ex.fe_group); | 3046 | ac->ac_b_ex.fe_group); |
3047 | spin_lock(sb_bgl_lock(sbi, flex_group)); | 3047 | atomic_sub(ac->ac_b_ex.fe_len, |
3048 | sbi->s_flex_groups[flex_group].free_blocks -= ac->ac_b_ex.fe_len; | 3048 | &sbi->s_flex_groups[flex_group].free_blocks); |
3049 | spin_unlock(sb_bgl_lock(sbi, flex_group)); | ||
3050 | } | 3049 | } |
3051 | 3050 | ||
3052 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | 3051 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); |
@@ -4884,9 +4883,7 @@ do_more: | |||
4884 | 4883 | ||
4885 | if (sbi->s_log_groups_per_flex) { | 4884 | if (sbi->s_log_groups_per_flex) { |
4886 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | 4885 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4887 | spin_lock(sb_bgl_lock(sbi, flex_group)); | 4886 | atomic_add(count, &sbi->s_flex_groups[flex_group].free_blocks); |
4888 | sbi->s_flex_groups[flex_group].free_blocks += count; | ||
4889 | spin_unlock(sb_bgl_lock(sbi, flex_group)); | ||
4890 | } | 4887 | } |
4891 | 4888 | ||
4892 | ext4_mb_release_desc(&e4b); | 4889 | ext4_mb_release_desc(&e4b); |