Btrfs-progs: reset balance before reiniting extent root

When we re-init the extent root we make it completely empty, so when we reset a
pending balance we will fail to find refs for any blocks we may cow, which will
result in errors and we will exit out.  We need to reset the balance first so
the normal cow stuff doesn't freak out and then we can re-init the extent tree.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
master
Josef Bacik 2013-12-11 11:17:52 -05:00 committed by Chris Mason
parent 80d5bf799e
commit d04707f787
1 changed files with 6 additions and 6 deletions

View File

@ -6008,6 +6008,12 @@ static int reinit_extent_tree(struct btrfs_fs_info *fs_info)
return ret;
}
ret = reset_balance(trans, fs_info);
if (ret) {
fprintf(stderr, "error reseting the pending balance\n");
return ret;
}
/* Ok we can allocate now, reinit the extent root */
ret = btrfs_fsck_reinit_root(trans, fs_info->extent_root, 0);
if (ret) {
@ -6020,12 +6026,6 @@ static int reinit_extent_tree(struct btrfs_fs_info *fs_info)
return ret;
}
ret = reset_balance(trans, fs_info);
if (ret) {
fprintf(stderr, "error reseting the pending balance\n");
return ret;
}
/*
* Now we have all the in-memory block groups setup so we can make
* allocations properly, and the metadata we care about is safe since we