Skip to content

Commit

Permalink
ext3: Don't call dquot_free_block() if we don't update anything
Browse files Browse the repository at this point in the history
dquot_free_block() is called in the end of ext3_new_blocks() and updates
information of the inode structure. However, this update is not necessary
if the number of blocks we requested is equal to the number of
allocated blocks.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Kazuya Mio authored and Jan Kara committed Feb 29, 2012
1 parent 75b09e0 commit 053800a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/ext3/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,8 +1743,11 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,

*errp = 0;
brelse(bitmap_bh);
dquot_free_block(inode, *count-num);
*count = num;

if (num < *count) {
dquot_free_block(inode, *count-num);
*count = num;
}

trace_ext3_allocate_blocks(inode, goal, num,
(unsigned long long)ret_block);
Expand Down

0 comments on commit 053800a

Please sign in to comment.