Skip to content

Commit 14927d9

Browse files
Miao XieChris Mason
authored andcommitted
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 <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 7bf811a commit 14927d9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/btrfs/root-tree.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,6 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
299299
continue;
300300
}
301301

302-
if (btrfs_root_refs(&root->root_item) == 0) {
303-
btrfs_add_dead_root(root);
304-
continue;
305-
}
306-
307302
err = btrfs_init_fs_root(root);
308303
if (err) {
309304
btrfs_free_fs_root(root);
@@ -318,6 +313,9 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
318313
btrfs_free_fs_root(root);
319314
break;
320315
}
316+
317+
if (btrfs_root_refs(&root->root_item) == 0)
318+
btrfs_add_dead_root(root);
321319
}
322320

323321
btrfs_free_path(path);

0 commit comments

Comments
 (0)