提交 cf67582b 编写于 作者: C Chris Mason

Btrfs: Fix duplicate ENOSPC checks in find_free_extent

find_free_extent would fail to wrap around to the start of the drive because
it was doing the enospc case checking twice in some cases, causing it
to return -ENOSPC early.
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 d3c2fdcf
...@@ -1111,20 +1111,9 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -1111,20 +1111,9 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_release_path(root, path); btrfs_release_path(root, path);
BUG_ON(ins->objectid < search_start); BUG_ON(ins->objectid < search_start);
if (ins->objectid + num_blocks >= search_end) { if (ins->objectid + num_blocks >= search_end)
if (full_scan) { goto enospc;
ret = -ENOSPC;
goto error;
}
search_start = orig_search_start;
if (wrapped) {
if (!full_scan)
total_needed -= empty_size;
full_scan = 1;
} else
wrapped = 1;
goto new_group;
}
for (test_block = ins->objectid; for (test_block = ins->objectid;
test_block < ins->objectid + num_blocks; test_block++) { test_block < ins->objectid + num_blocks; test_block++) {
if (test_radix_bit(&info->pinned_radix, test_block) || if (test_radix_bit(&info->pinned_radix, test_block) ||
...@@ -1149,6 +1138,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -1149,6 +1138,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
new_group: new_group:
if (search_start + num_blocks >= search_end) { if (search_start + num_blocks >= search_end) {
enospc:
search_start = orig_search_start; search_start = orig_search_start;
if (full_scan) { if (full_scan) {
ret = -ENOSPC; ret = -ENOSPC;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册