aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1b9b87870f51..90d314eeff6d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6756,22 +6756,16 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)
6756 6756
6757 /* 6757 /*
6758 * if this is the last block group we have in this space, we can't 6758 * if this is the last block group we have in this space, we can't
6759 * relocate it. 6759 * relocate it unless we're able to allocate a new chunk below.
6760 *
6761 * Otherwise, we need to make sure we have room in the space to handle
6762 * all of the extents from this block group. If we can, we're good
6760 */ 6763 */
6761 if (space_info->total_bytes == block_group->key.offset) { 6764 if ((space_info->total_bytes != block_group->key.offset) &&
6762 ret = -1; 6765 (space_info->bytes_used + space_info->bytes_reserved +
6763 spin_unlock(&space_info->lock);
6764 goto out;
6765 }
6766
6767 /*
6768 * need to make sure we have room in the space to handle all of the
6769 * extents from this block group. If we can, we're good
6770 */
6771 if (space_info->bytes_used + space_info->bytes_reserved +
6772 space_info->bytes_pinned + space_info->bytes_readonly + 6766 space_info->bytes_pinned + space_info->bytes_readonly +
6773 btrfs_block_group_used(&block_group->item) < 6767 btrfs_block_group_used(&block_group->item) <
6774 space_info->total_bytes) { 6768 space_info->total_bytes)) {
6775 spin_unlock(&space_info->lock); 6769 spin_unlock(&space_info->lock);
6776 goto out; 6770 goto out;
6777 } 6771 }