Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33d85fda authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba
Browse files

btrfs: Don't generate UUID for non-fs tree



btrfs_create_tree() will unconditionally generate UUID for any root.
So for quota tree and data reloc tree created by kernel, they will have
unique UUIDs.

However UUID in root item is only referred by UUID tree, which only
records UUID for fs trees.  This makes unique UUIDs for quota/data reloc
tree meaningless.

Leave the UUID as zero for non-fs tree, making btrfs-debug-tree output
less confusing.

Reported-by: default avatarMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 2c997384
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1243,7 +1243,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
	struct btrfs_root *root;
	struct btrfs_key key;
	int ret = 0;
	uuid_le uuid;
	uuid_le uuid = NULL_UUID_LE;

	root = btrfs_alloc_root(fs_info, GFP_KERNEL);
	if (!root)
@@ -1284,6 +1284,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
	btrfs_set_root_used(&root->root_item, leaf->len);
	btrfs_set_root_last_snapshot(&root->root_item, 0);
	btrfs_set_root_dirid(&root->root_item, 0);
	if (is_fstree(objectid))
		uuid_le_gen(&uuid);
	memcpy(root->root_item.uuid, uuid.b, BTRFS_UUID_SIZE);
	root->root_item.drop_level = 0;