diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b038188bd039..b0d6022eaa67 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1726,6 +1726,7 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac, | |||
1726 | { | 1726 | { |
1727 | unsigned free, fragments; | 1727 | unsigned free, fragments; |
1728 | unsigned i, bits; | 1728 | unsigned i, bits; |
1729 | int flex_size = ext4_flex_bg_size(EXT4_SB(ac->ac_sb)); | ||
1729 | struct ext4_group_desc *desc; | 1730 | struct ext4_group_desc *desc; |
1730 | struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group); | 1731 | struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group); |
1731 | 1732 | ||
@@ -1747,6 +1748,12 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac, | |||
1747 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) | 1748 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) |
1748 | return 0; | 1749 | return 0; |
1749 | 1750 | ||
1751 | /* Avoid using the first bg of a flexgroup for data files */ | ||
1752 | if ((ac->ac_flags & EXT4_MB_HINT_DATA) && | ||
1753 | (flex_size >= EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME) && | ||
1754 | ((group % flex_size) == 0)) | ||
1755 | return 0; | ||
1756 | |||
1750 | bits = ac->ac_sb->s_blocksize_bits + 1; | 1757 | bits = ac->ac_sb->s_blocksize_bits + 1; |
1751 | for (i = ac->ac_2order; i <= bits; i++) | 1758 | for (i = ac->ac_2order; i <= bits; i++) |
1752 | if (grp->bb_counters[i] > 0) | 1759 | if (grp->bb_counters[i] > 0) |