diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f8b27bf80aca..526e55358606 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2805,8 +2805,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2805 | } | 2805 | } |
2806 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; | 2806 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; |
2807 | ext4_free_group_clusters_set(sb, gdp, len); | 2807 | ext4_free_group_clusters_set(sb, gdp, len); |
2808 | ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh, | 2808 | ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh); |
2809 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
2810 | ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp); | 2809 | ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp); |
2811 | 2810 | ||
2812 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); | 2811 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); |
@@ -4666,8 +4665,7 @@ do_more: | |||
4666 | 4665 | ||
4667 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; | 4666 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; |
4668 | ext4_free_group_clusters_set(sb, gdp, ret); | 4667 | ext4_free_group_clusters_set(sb, gdp, ret); |
4669 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh, | 4668 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh); |
4670 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4671 | ext4_group_desc_csum_set(sb, block_group, gdp); | 4669 | ext4_group_desc_csum_set(sb, block_group, gdp); |
4672 | ext4_unlock_group(sb, block_group); | 4670 | ext4_unlock_group(sb, block_group); |
4673 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); | 4671 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); |
@@ -4811,8 +4809,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | |||
4811 | mb_free_blocks(NULL, &e4b, bit, count); | 4809 | mb_free_blocks(NULL, &e4b, bit, count); |
4812 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); | 4810 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); |
4813 | ext4_free_group_clusters_set(sb, desc, blk_free_count); | 4811 | ext4_free_group_clusters_set(sb, desc, blk_free_count); |
4814 | ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh, | 4812 | ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh); |
4815 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4816 | ext4_group_desc_csum_set(sb, block_group, desc); | 4813 | ext4_group_desc_csum_set(sb, block_group, desc); |
4817 | ext4_unlock_group(sb, block_group); | 4814 | ext4_unlock_group(sb, block_group); |
4818 | percpu_counter_add(&sbi->s_freeclusters_counter, | 4815 | percpu_counter_add(&sbi->s_freeclusters_counter, |
@@ -4993,8 +4990,9 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) | |||
4993 | minlen = EXT4_NUM_B2C(EXT4_SB(sb), | 4990 | minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
4994 | range->minlen >> sb->s_blocksize_bits); | 4991 | range->minlen >> sb->s_blocksize_bits); |
4995 | 4992 | ||
4996 | if (unlikely(minlen > EXT4_CLUSTERS_PER_GROUP(sb)) || | 4993 | if (minlen > EXT4_CLUSTERS_PER_GROUP(sb) || |
4997 | unlikely(start >= max_blks)) | 4994 | start >= max_blks || |
4995 | range->len < sb->s_blocksize) | ||
4998 | return -EINVAL; | 4996 | return -EINVAL; |
4999 | if (end >= max_blks) | 4997 | if (end >= max_blks) |
5000 | end = max_blks - 1; | 4998 | end = max_blks - 1; |