btrfs: simplify root lookup by id
The main function to lookup a root by its id btrfs_get_fs_root takes the whole key, while only using the objectid. The value of offset is preset to (u64)-1 but not actually used until btrfs_find_root that does the actual search. Switch btrfs_get_fs_root to use only objectid and remove all local variables that existed just for the lookup. The actual key for search is set up in btrfs_get_fs_root, reusing another key variable. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -257,7 +257,6 @@ out:
|
||||
static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
|
||||
u8 *uuid, u8 type, u64 subvolid)
|
||||
{
|
||||
struct btrfs_key key;
|
||||
int ret = 0;
|
||||
struct btrfs_root *subvol_root;
|
||||
|
||||
@@ -265,10 +264,7 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
|
||||
type != BTRFS_UUID_KEY_RECEIVED_SUBVOL)
|
||||
goto out;
|
||||
|
||||
key.objectid = subvolid;
|
||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||
key.offset = (u64)-1;
|
||||
subvol_root = btrfs_get_fs_root(fs_info, &key, true);
|
||||
subvol_root = btrfs_get_fs_root(fs_info, subvolid, true);
|
||||
if (IS_ERR(subvol_root)) {
|
||||
ret = PTR_ERR(subvol_root);
|
||||
if (ret == -ENOENT)
|
||||
|
Reference in New Issue
Block a user