ext4: Fix accounting of reserved metadata blocks
[linux-2.6.git] / fs / ext4 / inode.c
index 84eeb8f..bdaa92a 100644 (file)
@@ -1076,9 +1076,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
                 * only when we have written all of the delayed
                 * allocation blocks.
                 */
-               mdb_free = ei->i_allocated_meta_blocks;
+               mdb_free = ei->i_reserved_meta_blocks;
+               ei->i_reserved_meta_blocks = 0;
                percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free);
-               ei->i_allocated_meta_blocks = 0;
        }
        spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
 
@@ -1889,8 +1889,8 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
                 * only when we have written all of the delayed
                 * allocation blocks.
                 */
-               to_free += ei->i_allocated_meta_blocks;
-               ei->i_allocated_meta_blocks = 0;
+               to_free += ei->i_reserved_meta_blocks;
+               ei->i_reserved_meta_blocks = 0;
        }
 
        /* update fs dirty blocks counter */