diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/inode.c | 9 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a31980dd9b86..ddd0a9c87d9e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1046,7 +1046,7 @@ static int ext4_calc_metadata_amount(struct inode *inode, int blocks) | |||
1046 | static void ext4_da_update_reserve_space(struct inode *inode, int used) | 1046 | static void ext4_da_update_reserve_space(struct inode *inode, int used) |
1047 | { | 1047 | { |
1048 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 1048 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1049 | int total, mdb, mdb_free; | 1049 | int total, mdb, mdb_free, mdb_claim = 0; |
1050 | 1050 | ||
1051 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1051 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); |
1052 | /* recalculate the number of metablocks still need to be reserved */ | 1052 | /* recalculate the number of metablocks still need to be reserved */ |
@@ -1059,7 +1059,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | |||
1059 | 1059 | ||
1060 | if (mdb_free) { | 1060 | if (mdb_free) { |
1061 | /* Account for allocated meta_blocks */ | 1061 | /* Account for allocated meta_blocks */ |
1062 | mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks; | 1062 | mdb_claim = EXT4_I(inode)->i_allocated_meta_blocks; |
1063 | BUG_ON(mdb_free < mdb_claim); | ||
1064 | mdb_free -= mdb_claim; | ||
1063 | 1065 | ||
1064 | /* update fs dirty blocks counter */ | 1066 | /* update fs dirty blocks counter */ |
1065 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free); | 1067 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free); |
@@ -1070,8 +1072,11 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | |||
1070 | /* update per-inode reservations */ | 1072 | /* update per-inode reservations */ |
1071 | BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks); | 1073 | BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks); |
1072 | EXT4_I(inode)->i_reserved_data_blocks -= used; | 1074 | EXT4_I(inode)->i_reserved_data_blocks -= used; |
1075 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, used + mdb_claim); | ||
1073 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1076 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
1074 | 1077 | ||
1078 | vfs_dq_claim_block(inode, used + mdb_claim); | ||
1079 | |||
1075 | /* | 1080 | /* |
1076 | * free those over-booking quota for metadata blocks | 1081 | * free those over-booking quota for metadata blocks |
1077 | */ | 1082 | */ |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b1fd3daadc9c..d34afad3e137 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2755,12 +2755,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2755 | if (!(ac->ac_flags & EXT4_MB_DELALLOC_RESERVED)) | 2755 | if (!(ac->ac_flags & EXT4_MB_DELALLOC_RESERVED)) |
2756 | /* release all the reserved blocks if non delalloc */ | 2756 | /* release all the reserved blocks if non delalloc */ |
2757 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, reserv_blks); | 2757 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, reserv_blks); |
2758 | else { | ||
2759 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, | ||
2760 | ac->ac_b_ex.fe_len); | ||
2761 | /* convert reserved quota blocks to real quota blocks */ | ||
2762 | vfs_dq_claim_block(ac->ac_inode, ac->ac_b_ex.fe_len); | ||
2763 | } | ||
2764 | 2758 | ||
2765 | if (sbi->s_log_groups_per_flex) { | 2759 | if (sbi->s_log_groups_per_flex) { |
2766 | ext4_group_t flex_group = ext4_flex_group(sbi, | 2760 | ext4_group_t flex_group = ext4_flex_group(sbi, |