Skip to content

Commit 01cebce

Browse files
fdmananakdave
authored andcommitted
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 <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 7aa1788 commit 01cebce

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

fs/btrfs/uuid-tree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid,
3535
struct btrfs_key key;
3636

3737
if (WARN_ON_ONCE(!uuid_root))
38-
return -ENOENT;
38+
return -EINVAL;
3939

4040
path = btrfs_alloc_path();
4141
if (!path)
@@ -92,9 +92,6 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 typ
9292
if (ret != -ENOENT)
9393
return ret;
9494

95-
if (WARN_ON_ONCE(!uuid_root))
96-
return -EINVAL;
97-
9895
btrfs_uuid_to_key(uuid, type, &key);
9996

10097
path = btrfs_alloc_path();

0 commit comments

Comments
 (0)