aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-11 16:51:28 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-11 16:51:28 -0400
commit7ad9bb651fc2036ea94bed94da76a4b08959a911 (patch)
tree2669266f02c35b1b24d13d0adc4b3ac5afbdf7fd /fs/ext4
parent1f7bebb9e911d870fa8f997ddff838e82b5715ea (diff)
ext4: Fix initalization of s_flex_groups
The s_flex_groups array should have been initialized using atomic_add to sum up the free counts from the block groups that make up a flex_bg. By using atomic_set, the value of the s_flex_groups array was set to the values of the last block group in the flex_bg. The impact of this bug is that the block and inode allocation algorithms might not pick the best flex_bg for new allocation. Thanks to Damien Guibouret for pointing out this problem! Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9f6fa3f74629..04c693357336 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1694,12 +1694,12 @@ static int ext4_fill_flex_info(struct super_block *sb)
1694 gdp = ext4_get_group_desc(sb, i, NULL); 1694 gdp = ext4_get_group_desc(sb, i, NULL);
1695 1695
1696 flex_group = ext4_flex_group(sbi, i); 1696 flex_group = ext4_flex_group(sbi, i);
1697 atomic_set(&sbi->s_flex_groups[flex_group].free_inodes, 1697 atomic_add(ext4_free_inodes_count(sb, gdp),
1698 ext4_free_inodes_count(sb, gdp)); 1698 &sbi->s_flex_groups[flex_group].free_inodes);
1699 atomic_set(&sbi->s_flex_groups[flex_group].free_blocks, 1699 atomic_add(ext4_free_blks_count(sb, gdp),
1700 ext4_free_blks_count(sb, gdp)); 1700 &sbi->s_flex_groups[flex_group].free_blocks);
1701 atomic_set(&sbi->s_flex_groups[flex_group].used_dirs, 1701 atomic_add(ext4_used_dirs_count(sb, gdp),
1702 ext4_used_dirs_count(sb, gdp)); 1702 &sbi->s_flex_groups[flex_group].used_dirs);
1703 } 1703 }
1704 1704
1705 return 1; 1705 return 1;