Commit e91909aa authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: convert btrfs_get_global_root to use a switch statement

Use a switch statement instead of an endless chain of if statements
to make the code a little cleaner.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 85724171
...@@ -1172,25 +1172,28 @@ static struct btrfs_root *btrfs_get_global_root(struct btrfs_fs_info *fs_info, ...@@ -1172,25 +1172,28 @@ static struct btrfs_root *btrfs_get_global_root(struct btrfs_fs_info *fs_info,
.offset = 0, .offset = 0,
}; };
if (objectid == BTRFS_ROOT_TREE_OBJECTID) switch (objectid) {
case BTRFS_ROOT_TREE_OBJECTID:
return btrfs_grab_root(fs_info->tree_root); return btrfs_grab_root(fs_info->tree_root);
if (objectid == BTRFS_EXTENT_TREE_OBJECTID) case BTRFS_EXTENT_TREE_OBJECTID:
return btrfs_grab_root(btrfs_global_root(fs_info, &key)); return btrfs_grab_root(btrfs_global_root(fs_info, &key));
if (objectid == BTRFS_CHUNK_TREE_OBJECTID) case BTRFS_CHUNK_TREE_OBJECTID:
return btrfs_grab_root(fs_info->chunk_root); return btrfs_grab_root(fs_info->chunk_root);
if (objectid == BTRFS_DEV_TREE_OBJECTID) case BTRFS_DEV_TREE_OBJECTID:
return btrfs_grab_root(fs_info->dev_root); return btrfs_grab_root(fs_info->dev_root);
if (objectid == BTRFS_CSUM_TREE_OBJECTID) case BTRFS_CSUM_TREE_OBJECTID:
return btrfs_grab_root(btrfs_global_root(fs_info, &key)); return btrfs_grab_root(btrfs_global_root(fs_info, &key));
if (objectid == BTRFS_QUOTA_TREE_OBJECTID) case BTRFS_QUOTA_TREE_OBJECTID:
return btrfs_grab_root(fs_info->quota_root); return btrfs_grab_root(fs_info->quota_root);
if (objectid == BTRFS_UUID_TREE_OBJECTID) case BTRFS_UUID_TREE_OBJECTID:
return btrfs_grab_root(fs_info->uuid_root); return btrfs_grab_root(fs_info->uuid_root);
if (objectid == BTRFS_BLOCK_GROUP_TREE_OBJECTID) case BTRFS_BLOCK_GROUP_TREE_OBJECTID:
return btrfs_grab_root(fs_info->block_group_root); return btrfs_grab_root(fs_info->block_group_root);
if (objectid == BTRFS_FREE_SPACE_TREE_OBJECTID) case BTRFS_FREE_SPACE_TREE_OBJECTID:
return btrfs_grab_root(btrfs_global_root(fs_info, &key)); return btrfs_grab_root(btrfs_global_root(fs_info, &key));
return NULL; default:
return NULL;
}
} }
int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
......
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