aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ddf89626498a..51f113119b25 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1268,7 +1268,7 @@ int btrfs_relocate_chunk(struct btrfs_root *root,
1268 em_tree = &root->fs_info->mapping_tree.map_tree; 1268 em_tree = &root->fs_info->mapping_tree.map_tree;
1269 1269
1270 /* step one, relocate all the extents inside this chunk */ 1270 /* step one, relocate all the extents inside this chunk */
1271 ret = btrfs_shrink_extent_tree(extent_root, chunk_offset); 1271 ret = btrfs_relocate_block_group(extent_root, chunk_offset);
1272 BUG_ON(ret); 1272 BUG_ON(ret);
1273 1273
1274 trans = btrfs_start_transaction(root, 1); 1274 trans = btrfs_start_transaction(root, 1);
@@ -1308,15 +1308,18 @@ int btrfs_relocate_chunk(struct btrfs_root *root,
1308 BUG_ON(ret); 1308 BUG_ON(ret);
1309 } 1309 }
1310 1310
1311 ret = btrfs_remove_block_group(trans, extent_root, chunk_offset);
1312 BUG_ON(ret);
1313
1311 spin_lock(&em_tree->lock); 1314 spin_lock(&em_tree->lock);
1312 remove_extent_mapping(em_tree, em); 1315 remove_extent_mapping(em_tree, em);
1316 spin_unlock(&em_tree->lock);
1317
1313 kfree(map); 1318 kfree(map);
1314 em->bdev = NULL; 1319 em->bdev = NULL;
1315 1320
1316 /* once for the tree */ 1321 /* once for the tree */
1317 free_extent_map(em); 1322 free_extent_map(em);
1318 spin_unlock(&em_tree->lock);
1319
1320 /* once for us */ 1323 /* once for us */
1321 free_extent_map(em); 1324 free_extent_map(em);
1322 1325