From d23ea8706c91d5a625454de67c9700dfa688d8b5 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Wed, 11 Apr 2007 13:57:55 -0400 Subject: early support for multiple devices --- disk-io.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'disk-io.c') diff --git a/disk-io.c b/disk-io.c index 448482fb..dff3bd57 100644 --- a/disk-io.c +++ b/disk-io.c @@ -273,6 +273,7 @@ struct btrfs_root *open_ctree_fd(int fp, struct btrfs_super_block *super) struct btrfs_root *root = malloc(sizeof(struct btrfs_root)); struct btrfs_root *extent_root = malloc(sizeof(struct btrfs_root)); struct btrfs_root *tree_root = malloc(sizeof(struct btrfs_root)); + struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root)); struct btrfs_fs_info *fs_info = malloc(sizeof(*fs_info)); int ret; @@ -286,6 +287,7 @@ struct btrfs_root *open_ctree_fd(int fp, struct btrfs_super_block *super) fs_info->fs_root = root; fs_info->tree_root = tree_root; fs_info->extent_root = extent_root; + fs_info->dev_root = dev_root; fs_info->last_inode_alloc = 0; fs_info->last_inode_alloc_dirid = 0; fs_info->disk_super = super; @@ -299,6 +301,10 @@ struct btrfs_root *open_ctree_fd(int fp, struct btrfs_super_block *super) return NULL; } BUG_ON(ret < 0); + __setup_root(super, dev_root, fs_info, BTRFS_DEV_TREE_OBJECTID, fp); + dev_root->node = read_tree_block(dev_root, + btrfs_super_device_root(super)); + __setup_root(super, tree_root, fs_info, BTRFS_ROOT_TREE_OBJECTID, fp); tree_root->node = read_tree_block(tree_root, btrfs_super_root(super)); BUG_ON(!tree_root->node); -- cgit v1.2.3