summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2013-12-11 11:17:52 -0500
committerChris Mason <clm@fb.com>2014-01-31 08:22:14 -0800
commitd04707f78735d6bb119a2d088f99547949a65f3c (patch)
tree8042d41346e7422611797eb8523a837a328637ad
parent80d5bf799e730d63ba52243857de43fc4aca6c75 (diff)
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>
-rw-r--r--cmds-check.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmds-check.c b/cmds-check.c
index e7d4edfc..cb5ed3e8 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -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