提交 57f1642e 编写于 作者: N Nikolay Borisov 提交者: David Sterba

btrfs: Consolidate error checking for btrfs_alloc_chunk

The second if is really a subcase of ret being less than 0. So
introduce a generic if (ret < 0) check, and inside have another if
which explicitly handles the -ENOSPC and any other errors. No
functional changes.
Signed-off-by: NNikolay Borisov <nborisov@suse.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 1e7a1421
......@@ -4681,12 +4681,14 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
trans->allocating_chunk = false;
spin_lock(&space_info->lock);
if (ret < 0 && ret != -ENOSPC)
goto out;
if (ret)
space_info->full = 1;
else
if (ret < 0) {
if (ret == -ENOSPC)
space_info->full = 1;
else
goto out;
} else {
ret = 1;
}
space_info->force_alloc = CHUNK_ALLOC_NO_FORCE;
out:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册