btrfs-progs: mkfs: precreate the uuid tree
authorDavid Sterba <dsterba@suse.com>
Tue, 27 Feb 2018 19:38:49 +0000 (20:38 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Mar 2018 20:15:55 +0000 (22:15 +0200)
We can easily create the uuid tree that's usually created after first
mount. The kernel will still check the tree on first mount so we don't
try to fake the uuid tree generation so it appears consistent, even if
it's empty.

Signed-off-by: David Sterba <dsterba@suse.com>
mkfs/main.c

index 40efa26..b65b18d 100644 (file)
@@ -1208,6 +1208,11 @@ raid_groups:
                goto out;
        }
 
+       ret = create_tree(trans, root, BTRFS_UUID_TREE_OBJECTID);
+       if (ret)
+               warning(
+       "unable to create uuid tree, will be created after mount: %d", ret);
+
        ret = btrfs_commit_transaction(trans, root);
        if (ret) {
                error("unable to commit transaction: %d", ret);