diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 99ab428bcfa0..1cd6994fc446 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -788,7 +788,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore) | |||
788 | int first_block; | 788 | int first_block; |
789 | struct super_block *sb; | 789 | struct super_block *sb; |
790 | struct buffer_head *bhs; | 790 | struct buffer_head *bhs; |
791 | struct buffer_head **bh; | 791 | struct buffer_head **bh = NULL; |
792 | struct inode *inode; | 792 | struct inode *inode; |
793 | char *data; | 793 | char *data; |
794 | char *bitmap; | 794 | char *bitmap; |
@@ -2375,7 +2375,7 @@ static int ext4_groupinfo_create_slab(size_t size) | |||
2375 | return 0; | 2375 | return 0; |
2376 | } | 2376 | } |
2377 | 2377 | ||
2378 | int ext4_mb_init(struct super_block *sb, int needs_recovery) | 2378 | int ext4_mb_init(struct super_block *sb) |
2379 | { | 2379 | { |
2380 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2380 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2381 | unsigned i, j; | 2381 | unsigned i, j; |
@@ -2517,6 +2517,9 @@ int ext4_mb_release(struct super_block *sb) | |||
2517 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2517 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2518 | struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); | 2518 | struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); |
2519 | 2519 | ||
2520 | if (sbi->s_proc) | ||
2521 | remove_proc_entry("mb_groups", sbi->s_proc); | ||
2522 | |||
2520 | if (sbi->s_group_info) { | 2523 | if (sbi->s_group_info) { |
2521 | for (i = 0; i < ngroups; i++) { | 2524 | for (i = 0; i < ngroups; i++) { |
2522 | grinfo = ext4_get_group_info(sb, i); | 2525 | grinfo = ext4_get_group_info(sb, i); |
@@ -2564,8 +2567,6 @@ int ext4_mb_release(struct super_block *sb) | |||
2564 | } | 2567 | } |
2565 | 2568 | ||
2566 | free_percpu(sbi->s_locality_groups); | 2569 | free_percpu(sbi->s_locality_groups); |
2567 | if (sbi->s_proc) | ||
2568 | remove_proc_entry("mb_groups", sbi->s_proc); | ||
2569 | 2570 | ||
2570 | return 0; | 2571 | return 0; |
2571 | } | 2572 | } |
@@ -2797,7 +2798,9 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2797 | } | 2798 | } |
2798 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; | 2799 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; |
2799 | ext4_free_group_clusters_set(sb, gdp, len); | 2800 | ext4_free_group_clusters_set(sb, gdp, len); |
2800 | gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp); | 2801 | ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh, |
2802 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
2803 | ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp); | ||
2801 | 2804 | ||
2802 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); | 2805 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); |
2803 | percpu_counter_sub(&sbi->s_freeclusters_counter, ac->ac_b_ex.fe_len); | 2806 | percpu_counter_sub(&sbi->s_freeclusters_counter, ac->ac_b_ex.fe_len); |
@@ -3071,13 +3074,9 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac) | |||
3071 | static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) | 3074 | static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) |
3072 | { | 3075 | { |
3073 | struct ext4_prealloc_space *pa = ac->ac_pa; | 3076 | struct ext4_prealloc_space *pa = ac->ac_pa; |
3074 | int len; | ||
3075 | |||
3076 | if (pa && pa->pa_type == MB_INODE_PA) { | ||
3077 | len = ac->ac_b_ex.fe_len; | ||
3078 | pa->pa_free += len; | ||
3079 | } | ||
3080 | 3077 | ||
3078 | if (pa && pa->pa_type == MB_INODE_PA) | ||
3079 | pa->pa_free += ac->ac_b_ex.fe_len; | ||
3081 | } | 3080 | } |
3082 | 3081 | ||
3083 | /* | 3082 | /* |
@@ -4636,6 +4635,7 @@ do_more: | |||
4636 | */ | 4635 | */ |
4637 | new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); | 4636 | new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); |
4638 | if (!new_entry) { | 4637 | if (!new_entry) { |
4638 | ext4_mb_unload_buddy(&e4b); | ||
4639 | err = -ENOMEM; | 4639 | err = -ENOMEM; |
4640 | goto error_return; | 4640 | goto error_return; |
4641 | } | 4641 | } |
@@ -4659,7 +4659,9 @@ do_more: | |||
4659 | 4659 | ||
4660 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; | 4660 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; |
4661 | ext4_free_group_clusters_set(sb, gdp, ret); | 4661 | ext4_free_group_clusters_set(sb, gdp, ret); |
4662 | gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp); | 4662 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh, |
4663 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4664 | ext4_group_desc_csum_set(sb, block_group, gdp); | ||
4663 | ext4_unlock_group(sb, block_group); | 4665 | ext4_unlock_group(sb, block_group); |
4664 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); | 4666 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); |
4665 | 4667 | ||
@@ -4803,7 +4805,9 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | |||
4803 | mb_free_blocks(NULL, &e4b, bit, count); | 4805 | mb_free_blocks(NULL, &e4b, bit, count); |
4804 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); | 4806 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); |
4805 | ext4_free_group_clusters_set(sb, desc, blk_free_count); | 4807 | ext4_free_group_clusters_set(sb, desc, blk_free_count); |
4806 | desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc); | 4808 | ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh, |
4809 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4810 | ext4_group_desc_csum_set(sb, block_group, desc); | ||
4807 | ext4_unlock_group(sb, block_group); | 4811 | ext4_unlock_group(sb, block_group); |
4808 | percpu_counter_add(&sbi->s_freeclusters_counter, | 4812 | percpu_counter_add(&sbi->s_freeclusters_counter, |
4809 | EXT4_B2C(sbi, blocks_freed)); | 4813 | EXT4_B2C(sbi, blocks_freed)); |