瀏覽代碼

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>
Kazuya Mio 13 年之前
父節點
當前提交
053800a84b
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      fs/ext3/balloc.c

+ 5 - 2
fs/ext3/balloc.c

@@ -1743,8 +1743,11 @@ allocated:
 
 
 	*errp = 0;
 	*errp = 0;
 	brelse(bitmap_bh);
 	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,
 	trace_ext3_allocate_blocks(inode, goal, num,
 				   (unsigned long long)ret_block);
 				   (unsigned long long)ret_block);