diff options
author | David Sterba <dsterba@suse.com> | 2020-05-15 19:35:55 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-05-25 11:25:36 +0200 |
commit | 56e9357a1e8167134388d4c70654795353765c7b (patch) | |
tree | e89265fd992d94c54fffb639cf4ee39bd268cfdb /fs/btrfs/export.c | |
parent | 1dae7e0e58b484eaa43d530f211098fdeeb0f404 (diff) | |
download | lwn-56e9357a1e8167134388d4c70654795353765c7b.tar.gz lwn-56e9357a1e8167134388d4c70654795353765c7b.zip |
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>
Diffstat (limited to 'fs/btrfs/export.c')
-rw-r--r-- | fs/btrfs/export.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 2bb25d2dc44b..e7cc98b4d7dc 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -69,11 +69,7 @@ struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, if (objectid < BTRFS_FIRST_FREE_OBJECTID) return ERR_PTR(-ESTALE); - key.objectid = root_objectid; - key.type = BTRFS_ROOT_ITEM_KEY; - key.offset = (u64)-1; - - root = btrfs_get_fs_root(fs_info, &key, true); + root = btrfs_get_fs_root(fs_info, root_objectid, true); if (IS_ERR(root)) return ERR_CAST(root); |