path: root/fs/btrfs/relocation.c
diff options
authorYan Zheng <>2009-06-27 21:07:35 -0400
committerChris Mason <>2009-07-02 13:41:17 -0400
commit2c47e605a91dde6b0514f689645e7ab336c8592a (patch)
treed541e61440f06f37d17e2d14cbaa78fc0cd41ff2 /fs/btrfs/relocation.c
parenta970b0a16cc416a509d5ae8b1d70978664e6f4fe (diff)
Btrfs: update backrefs while dropping snapshot
The new backref format has restriction on type of backref item. If a tree block isn't referenced by its owner tree, full backrefs must be used for the pointers in it. When a tree block loses its owner tree's reference, backrefs for the pointers in it should be updated to full backrefs. Current btrfs_drop_snapshot misses the code that updates backrefs, so it's unsafe for general use. This patch adds backrefs update code to btrfs_drop_snapshot. It isn't a problem in the restricted form btrfs_drop_snapshot is used today, but for general snapshot deletion this update is required. Signed-off-by: Yan Zheng <> Signed-off-by: Chris Mason <>
Diffstat (limited to 'fs/btrfs/relocation.c')
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index b23dc209ae10..008397934778 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1788,7 +1788,7 @@ static void merge_func(struct btrfs_work *work)
btrfs_end_transaction(trans, root);
- btrfs_drop_dead_root(reloc_root);
+ btrfs_drop_snapshot(reloc_root, 0);
if (atomic_dec_and_test(async->num_pending))
@@ -2075,9 +2075,6 @@ static int do_relocation(struct btrfs_trans_handle *trans,
ret = btrfs_drop_subtree(trans, root, eb, upper->eb);
- btrfs_tree_unlock(eb);
- free_extent_buffer(eb);
if (!lowest) {