aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-09-17 11:00:51 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commitcf67582bb2ec364d71b3e4f8e49de98d8c3c832e (patch)
tree9f51995b1877953c9d15eee72d44881e6c4962bc /fs/btrfs/extent-tree.c
parentd3c2fdcf7b79079f60ac64e61d886964d4647910 (diff)
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: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fe772f9b06cf..f261a8326cdf 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1111,20 +1111,9 @@ check_pending:
1111 btrfs_release_path(root, path); 1111 btrfs_release_path(root, path);
1112 BUG_ON(ins->objectid < search_start); 1112 BUG_ON(ins->objectid < search_start);
1113 1113
1114 if (ins->objectid + num_blocks >= search_end) { 1114 if (ins->objectid + num_blocks >= search_end)
1115 if (full_scan) { 1115 goto enospc;
1116 ret = -ENOSPC; 1116
1117 goto error;
1118 }
1119 search_start = orig_search_start;
1120 if (wrapped) {
1121 if (!full_scan)
1122 total_needed -= empty_size;
1123 full_scan = 1;
1124 } else
1125 wrapped = 1;
1126 goto new_group;
1127 }
1128 for (test_block = ins->objectid; 1117 for (test_block = ins->objectid;
1129 test_block < ins->objectid + num_blocks; test_block++) { 1118 test_block < ins->objectid + num_blocks; test_block++) {
1130 if (test_radix_bit(&info->pinned_radix, test_block) || 1119 if (test_radix_bit(&info->pinned_radix, test_block) ||
@@ -1149,6 +1138,7 @@ check_pending:
1149 1138
1150new_group: 1139new_group:
1151 if (search_start + num_blocks >= search_end) { 1140 if (search_start + num_blocks >= search_end) {
1141enospc:
1152 search_start = orig_search_start; 1142 search_start = orig_search_start;
1153 if (full_scan) { 1143 if (full_scan) {
1154 ret = -ENOSPC; 1144 ret = -ENOSPC;