diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-10 07:26:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-10 07:26:33 -0500 |
commit | 5b7c3fcc46b5deb8a368d5319cf87c78c2df65fe (patch) | |
tree | 7338c64a5431e65a5fa27b0df0c7f6e2baf0b884 /fs | |
parent | 5f2cc086ccab27ac5252b3883ac004347860b4c7 (diff) |
Btrfs: Don't substract too much from the allocation target (avoid wrapping)
When metadata allocation clustering has to fall back to unclustered
allocs because large free areas could not be found, it was sometimes
substracting too much from the total bytes to allocate. This would
make it wrap below zero.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b92e92c29e3b..2451717d36de 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2255,9 +2255,9 @@ new_group: | |||
2255 | mutex_unlock(&block_group->alloc_mutex); | 2255 | mutex_unlock(&block_group->alloc_mutex); |
2256 | new_group_no_lock: | 2256 | new_group_no_lock: |
2257 | last_wanted = 0; | 2257 | last_wanted = 0; |
2258 | if (!allowed_chunk_alloc && loop > 0) { | 2258 | if (!allowed_chunk_alloc) { |
2259 | total_needed -= empty_cluster; | 2259 | total_needed -= empty_size; |
2260 | empty_cluster = 0; | 2260 | empty_size = 0; |
2261 | } | 2261 | } |
2262 | /* | 2262 | /* |
2263 | * Here's how this works. | 2263 | * Here's how this works. |
@@ -2277,8 +2277,8 @@ new_group_no_lock: | |||
2277 | loop++; | 2277 | loop++; |
2278 | } else if (loop == 1 && cur == head) { | 2278 | } else if (loop == 1 && cur == head) { |
2279 | 2279 | ||
2280 | total_needed -= empty_cluster; | 2280 | total_needed -= empty_size; |
2281 | empty_cluster = 0; | 2281 | empty_size = 0; |
2282 | 2282 | ||
2283 | if (allowed_chunk_alloc && !chunk_alloc_done) { | 2283 | if (allowed_chunk_alloc && !chunk_alloc_done) { |
2284 | up_read(&space_info->groups_sem); | 2284 | up_read(&space_info->groups_sem); |