aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-09-25 09:47:43 -0400
committerChris Mason <chris.mason@fusionio.com>2013-10-10 21:30:53 -0400
commit14927d95464956ffe8af4278331a6bfea94ab780 (patch)
treeeb9dcde86e2ea82d4c4f9997646cc6bcde75a49e /fs
parent7bf811a595a895b7a886dcf218d0d34f97df76dc (diff)
Btrfs: insert orphan roots into fs radix tree
Now we don't drop all the deleted snapshots/subvolumes before the space balance. It means we have to relocate the space which is held by the dead snapshots/subvolumes. So we must into them into fs radix tree, or we would forget to commit the change of them when doing transaction commit, and it would corrupt the metadata. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/root-tree.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 0b1f4ef8db98..ec71ea44d2b4 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -299,11 +299,6 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
299 continue; 299 continue;
300 } 300 }
301 301
302 if (btrfs_root_refs(&root->root_item) == 0) {
303 btrfs_add_dead_root(root);
304 continue;
305 }
306
307 err = btrfs_init_fs_root(root); 302 err = btrfs_init_fs_root(root);
308 if (err) { 303 if (err) {
309 btrfs_free_fs_root(root); 304 btrfs_free_fs_root(root);
@@ -318,6 +313,9 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
318 btrfs_free_fs_root(root); 313 btrfs_free_fs_root(root);
319 break; 314 break;
320 } 315 }
316
317 if (btrfs_root_refs(&root->root_item) == 0)
318 btrfs_add_dead_root(root);
321 } 319 }
322 320
323 btrfs_free_path(path); 321 btrfs_free_path(path);