diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-10 16:13:54 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-10 16:13:54 -0500 |
commit | 8a1413a296d38b54ded651e76ef16c033d38fd5d (patch) | |
tree | 846016af5294059bf967c4c30fa2895557ba28c9 /fs/btrfs/extent-tree.c | |
parent | 240d5d482b69415b92ffce4b8dfca10799c9890b (diff) | |
download | linux-8a1413a296d38b54ded651e76ef16c033d38fd5d.tar.bz2 |
Btrfs: empty_size allocation fixes again
The allocator wasn't catching all of the cases where it needed to do
extra loops because the check to enforce them wasn't happening early
enough.
When the allocator decided to increase the size of the allocation
for metadata clustering, it wasn't always setting the empty_size to
include the extra (optional) bytes. This also fixes the empty_size field
to be correct.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 55d6a66c622d..b7530c3ac206 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2174,6 +2174,9 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, * group thats not of the proper type, while looping this * should never happen */ + if (empty_size) + extra_loop = 1; + if (!block_group) goto new_group_no_lock; @@ -2192,9 +2195,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, free_space = btrfs_find_free_space(block_group, search_start, total_needed); - if (empty_size) - extra_loop = 1; - if (free_space) { u64 start = block_group->key.objectid; u64 end = block_group->key.objectid + @@ -2212,6 +2212,7 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, if (last_wanted && search_start != last_wanted) { total_needed += empty_cluster; + empty_size += empty_cluster; last_wanted = 0; /* * if search_start is still in this block group |