aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index eb9d449817d0..7875a2dd54b9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1030,19 +1030,20 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1030 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); 1030 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
1031 mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb; 1031 mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb;
1032 1032
1033 /* Account for allocated meta_blocks */ 1033 if (mdb_free) {
1034 mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks; 1034 /* Account for allocated meta_blocks */
1035 1035 mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks;
1036 /* update fs free blocks counter for truncate case */ 1036
1037 percpu_counter_add(&sbi->s_freeblocks_counter, mdb_free); 1037 /* update fs dirty blocks counter */
1038 percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free);
1039 EXT4_I(inode)->i_allocated_meta_blocks = 0;
1040 EXT4_I(inode)->i_reserved_meta_blocks = mdb;
1041 }
1038 1042
1039 /* update per-inode reservations */ 1043 /* update per-inode reservations */
1040 BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks); 1044 BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks);
1041 EXT4_I(inode)->i_reserved_data_blocks -= used; 1045 EXT4_I(inode)->i_reserved_data_blocks -= used;
1042 1046
1043 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
1044 EXT4_I(inode)->i_reserved_meta_blocks = mdb;
1045 EXT4_I(inode)->i_allocated_meta_blocks = 0;
1046 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1047 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1047} 1048}
1048 1049
@@ -1588,8 +1589,8 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1588 1589
1589 release = to_free + mdb_free; 1590 release = to_free + mdb_free;
1590 1591
1591 /* update fs free blocks counter for truncate case */ 1592 /* update fs dirty blocks counter for truncate case */
1592 percpu_counter_add(&sbi->s_freeblocks_counter, release); 1593 percpu_counter_sub(&sbi->s_dirtyblocks_counter, release);
1593 1594
1594 /* update per-inode reservations */ 1595 /* update per-inode reservations */
1595 BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks); 1596 BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks);
@@ -2471,7 +2472,6 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
2471 index = pos >> PAGE_CACHE_SHIFT; 2472 index = pos >> PAGE_CACHE_SHIFT;
2472 from = pos & (PAGE_CACHE_SIZE - 1); 2473 from = pos & (PAGE_CACHE_SIZE - 1);
2473 to = from + len; 2474 to = from + len;
2474
2475retry: 2475retry:
2476 /* 2476 /*
2477 * With delayed allocation, we don't log the i_disksize update 2477 * With delayed allocation, we don't log the i_disksize update