diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-11 13:57:44 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-11 13:57:44 -0400 |
commit | 0bd93ba022f5c1ddb4e5b722b02f3c4a4a8865ad (patch) | |
tree | f7f0620a6c5f4b446c650dc6864d3ee544cb8aa5 /fs/btrfs/disk-io.c | |
parent | cac87faa09f56776602d4b6f15c1bd44f6da300e (diff) |
Btrfs: early support for multiple devices
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index ff69162829b3..e09233262af6 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -378,6 +378,8 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
378 | { | 378 | { |
379 | struct btrfs_root *extent_root = kmalloc(sizeof(struct btrfs_root), | 379 | struct btrfs_root *extent_root = kmalloc(sizeof(struct btrfs_root), |
380 | GFP_NOFS); | 380 | GFP_NOFS); |
381 | struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root), | ||
382 | GFP_NOFS); | ||
381 | struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root), | 383 | struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root), |
382 | GFP_NOFS); | 384 | GFP_NOFS); |
383 | struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info), | 385 | struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info), |
@@ -392,6 +394,7 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
392 | fs_info->running_transaction = NULL; | 394 | fs_info->running_transaction = NULL; |
393 | fs_info->tree_root = tree_root; | 395 | fs_info->tree_root = tree_root; |
394 | fs_info->extent_root = extent_root; | 396 | fs_info->extent_root = extent_root; |
397 | fs_info->dev_root = dev_root; | ||
395 | fs_info->sb = sb; | 398 | fs_info->sb = sb; |
396 | fs_info->btree_inode = new_inode(sb); | 399 | fs_info->btree_inode = new_inode(sb); |
397 | fs_info->btree_inode->i_ino = 1; | 400 | fs_info->btree_inode->i_ino = 1; |
@@ -414,6 +417,9 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
414 | memset(&fs_info->current_insert, 0, sizeof(fs_info->current_insert)); | 417 | memset(&fs_info->current_insert, 0, sizeof(fs_info->current_insert)); |
415 | memset(&fs_info->last_insert, 0, sizeof(fs_info->last_insert)); | 418 | memset(&fs_info->last_insert, 0, sizeof(fs_info->last_insert)); |
416 | 419 | ||
420 | __setup_root(sb->s_blocksize, dev_root, | ||
421 | fs_info, BTRFS_DEV_TREE_OBJECTID); | ||
422 | |||
417 | __setup_root(sb->s_blocksize, tree_root, | 423 | __setup_root(sb->s_blocksize, tree_root, |
418 | fs_info, BTRFS_ROOT_TREE_OBJECTID); | 424 | fs_info, BTRFS_ROOT_TREE_OBJECTID); |
419 | fs_info->sb_buffer = read_tree_block(tree_root, | 425 | fs_info->sb_buffer = read_tree_block(tree_root, |
@@ -427,6 +433,8 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
427 | return NULL; | 433 | return NULL; |
428 | 434 | ||
429 | fs_info->disk_super = disk_super; | 435 | fs_info->disk_super = disk_super; |
436 | dev_root->node = read_tree_block(tree_root, | ||
437 | btrfs_super_device_root(disk_super)); | ||
430 | tree_root->node = read_tree_block(tree_root, | 438 | tree_root->node = read_tree_block(tree_root, |
431 | btrfs_super_root(disk_super)); | 439 | btrfs_super_root(disk_super)); |
432 | BUG_ON(!tree_root->node); | 440 | BUG_ON(!tree_root->node); |
@@ -519,6 +527,9 @@ int close_ctree(struct btrfs_root *root) | |||
519 | if (fs_info->extent_root->node) | 527 | if (fs_info->extent_root->node) |
520 | btrfs_block_release(fs_info->extent_root, | 528 | btrfs_block_release(fs_info->extent_root, |
521 | fs_info->extent_root->node); | 529 | fs_info->extent_root->node); |
530 | if (fs_info->dev_root->node) | ||
531 | btrfs_block_release(fs_info->dev_root, | ||
532 | fs_info->dev_root->node); | ||
522 | if (fs_info->tree_root->node) | 533 | if (fs_info->tree_root->node) |
523 | btrfs_block_release(fs_info->tree_root, | 534 | btrfs_block_release(fs_info->tree_root, |
524 | fs_info->tree_root->node); | 535 | fs_info->tree_root->node); |