btrfs-progs: mkfs: Cleanup temporary chunks before filling rootdir
[platform/upstream/btrfs-progs.git] / mkfs / main.c
index 5b5193d..ec6b2f8 100644 (file)
@@ -1223,6 +1223,13 @@ raid_groups:
                goto out;
        }
 
+       ret = cleanup_temp_chunks(fs_info, &allocation, data_profile,
+                                 metadata_profile, metadata_profile);
+       if (ret < 0) {
+               error("failed to cleanup temporary chunks: %d", ret);
+               goto out;
+       }
+
        if (source_dir_set) {
                trans = btrfs_start_transaction(root, 1);
                BUG_ON(IS_ERR(trans));
@@ -1245,12 +1252,6 @@ raid_groups:
                        goto out;
                }
        }
-       ret = cleanup_temp_chunks(fs_info, &allocation, data_profile,
-                                 metadata_profile, metadata_profile);
-       if (ret < 0) {
-               error("failed to cleanup temporary chunks: %d", ret);
-               goto out;
-       }
 
        if (verbose) {
                char features_buf[64];