瀏覽代碼

ext4: let ext4_group_add_blocks() handle 0 blocks quickly

If ext4_group_add_blocks() is called with 0 block, make it return 0
without doing any extra work.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Yongqiang Yang 14 年之前
父節點
當前提交
4740b830ed
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      fs/ext4/mballoc.c

+ 3 - 0
fs/ext4/mballoc.c

@@ -4691,6 +4691,9 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
 
 
 	ext4_debug("Adding block(s) %llu-%llu\n", block, block + count - 1);
 	ext4_debug("Adding block(s) %llu-%llu\n", block, block + count - 1);
 
 
+	if (count == 0)
+		return 0;
+
 	ext4_get_group_no_and_offset(sb, block, &block_group, &bit);
 	ext4_get_group_no_and_offset(sb, block, &block_group, &bit);
 	/*
 	/*
 	 * Check to see if we are freeing blocks across a group
 	 * Check to see if we are freeing blocks across a group