From: Kazuya Mio Date: Mon, 30 Jan 2012 08:41:25 +0000 (+0900) Subject: ext3: Don't call dquot_free_block() if we don't update anything X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=053800a84b942511054b51299db4430b3d1b06bc;p=deliverable%2Flinux.git 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 Signed-off-by: Jan Kara --- diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index a2038928f9a3..954a7d355f59 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -1743,8 +1743,11 @@ allocated: *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);