Commit e1922118 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: relocation: Remove is_cowonly_root()

This function is only used in read_fs_root(), which is just a wrapper of
btrfs_get_fs_root().

For all the mentioned essential roots except log root tree,
btrfs_get_fs_root() has its own quick path to grab them from fs_info
directly, thus no need for key.offset modification.

For subvolume trees, btrfs_get_fs_root() with key.offset == -1 is
completely fine.

For log trees and log root tree, it's impossible to hit them, as for
relocation all backrefs are fetched from commit root, which never
records log tree blocks.

Log tree blocks either get freed in regular transaction commit, or
replayed at mount time. At runtime we should never hit an backref for
log tree in extent tree.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.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 fe119a6e
...@@ -640,21 +640,6 @@ static struct btrfs_root *find_reloc_root(struct reloc_control *rc, ...@@ -640,21 +640,6 @@ static struct btrfs_root *find_reloc_root(struct reloc_control *rc,
return btrfs_grab_root(root); return btrfs_grab_root(root);
} }
static int is_cowonly_root(u64 root_objectid)
{
if (root_objectid == BTRFS_ROOT_TREE_OBJECTID ||
root_objectid == BTRFS_EXTENT_TREE_OBJECTID ||
root_objectid == BTRFS_CHUNK_TREE_OBJECTID ||
root_objectid == BTRFS_DEV_TREE_OBJECTID ||
root_objectid == BTRFS_TREE_LOG_OBJECTID ||
root_objectid == BTRFS_CSUM_TREE_OBJECTID ||
root_objectid == BTRFS_UUID_TREE_OBJECTID ||
root_objectid == BTRFS_QUOTA_TREE_OBJECTID ||
root_objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
return 1;
return 0;
}
static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info, static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info,
u64 root_objectid) u64 root_objectid)
{ {
...@@ -662,10 +647,7 @@ static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info, ...@@ -662,10 +647,7 @@ static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info,
key.objectid = root_objectid; key.objectid = root_objectid;
key.type = BTRFS_ROOT_ITEM_KEY; key.type = BTRFS_ROOT_ITEM_KEY;
if (is_cowonly_root(root_objectid)) key.offset = (u64)-1;
key.offset = 0;
else
key.offset = (u64)-1;
return btrfs_get_fs_root(fs_info, &key, false); return btrfs_get_fs_root(fs_info, &key, false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment