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: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
这个提交包含在:
Nikolay Borisov
2018-04-11 11:21:19 +03:00
提交者 David Sterba
父节点 1e7a14211b
当前提交 57f1642ec3

查看文件

@@ -4681,12 +4681,14 @@ again:
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: