Skip to content

Commit 053800a

Browse files
Kazuya Miojankara
authored andcommitted
ext3: Don't call dquot_free_block() if we don't update anything
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>
1 parent 75b09e0 commit 053800a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎fs/ext3/balloc.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,8 +1743,11 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
17431743

17441744
*errp = 0;
17451745
brelse(bitmap_bh);
1746-
dquot_free_block(inode, *count-num);
1747-
*count = num;
1746+
1747+
if (num < *count) {
1748+
dquot_free_block(inode, *count-num);
1749+
*count = num;
1750+
}
17481751

17491752
trace_ext3_allocate_blocks(inode, goal, num,
17501753
(unsigned long long)ret_block);

0 commit comments

Comments
 (0)