diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1ba2cc58eab5..c8c318494dee 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5159,6 +5159,14 @@ have_block_group: | |||
5159 | if (unlikely(block_group->ro)) | 5159 | if (unlikely(block_group->ro)) |
5160 | goto loop; | 5160 | goto loop; |
5161 | 5161 | ||
5162 | spin_lock(&block_group->tree_lock); | ||
5163 | if (cached && | ||
5164 | block_group->free_space < num_bytes + empty_size) { | ||
5165 | spin_unlock(&block_group->tree_lock); | ||
5166 | goto loop; | ||
5167 | } | ||
5168 | spin_unlock(&block_group->tree_lock); | ||
5169 | |||
5162 | /* | 5170 | /* |
5163 | * Ok we want to try and use the cluster allocator, so lets look | 5171 | * Ok we want to try and use the cluster allocator, so lets look |
5164 | * there, unless we are on LOOP_NO_EMPTY_SIZE, since we will | 5172 | * there, unless we are on LOOP_NO_EMPTY_SIZE, since we will |