From: Filipe Manana Date: Thu, 19 Feb 2026 16:05:39 +0000 (+0000) Subject: btrfs: remove duplicated uuid tree existence check in btrfs_uuid_tree_add() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01cebce71f2f90abe6a98d3066c085a34b95d96e;p=thirdparty%2Flinux.git btrfs: remove duplicated uuid tree existence check in btrfs_uuid_tree_add() There's no point in checking if the uuid root exists in btrfs_uuid_tree_add(), since we already do it in btrfs_uuid_tree_lookup(). We can just remove the check from btrfs_uuid_tree_add() and make btrfs_uuid_tree_lookup() return -EINVAL instead of -ENOENT in case the uuid tree does not exists. Reviewed-by: Boris Burkov Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba --- diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index 43c17a1d34513..276f0eb874d4f 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -35,7 +35,7 @@ static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid, struct btrfs_key key; if (WARN_ON_ONCE(!uuid_root)) - return -ENOENT; + return -EINVAL; path = btrfs_alloc_path(); if (!path) @@ -92,9 +92,6 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 typ if (ret != -ENOENT) return ret; - if (WARN_ON_ONCE(!uuid_root)) - return -EINVAL; - btrfs_uuid_to_key(uuid, type, &key); path = btrfs_alloc_path();