diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a6170ff19e7f..34cf1f1f47be 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -406,7 +406,6 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
406 | memset(&root->defrag_progress, 0, sizeof(root->defrag_progress)); | 406 | memset(&root->defrag_progress, 0, sizeof(root->defrag_progress)); |
407 | memset(&root->root_kobj, 0, sizeof(root->root_kobj)); | 407 | memset(&root->root_kobj, 0, sizeof(root->root_kobj)); |
408 | init_completion(&root->kobj_unregister); | 408 | init_completion(&root->kobj_unregister); |
409 | init_rwsem(&root->snap_sem); | ||
410 | root->defrag_running = 0; | 409 | root->defrag_running = 0; |
411 | root->defrag_level = 0; | 410 | root->defrag_level = 0; |
412 | root->root_key.objectid = objectid; | 411 | root->root_key.objectid = objectid; |
@@ -498,6 +497,21 @@ insert: | |||
498 | return root; | 497 | return root; |
499 | } | 498 | } |
500 | 499 | ||
500 | struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info, | ||
501 | u64 root_objectid) | ||
502 | { | ||
503 | struct btrfs_root *root; | ||
504 | |||
505 | if (root_objectid == BTRFS_ROOT_TREE_OBJECTID) | ||
506 | return fs_info->tree_root; | ||
507 | if (root_objectid == BTRFS_EXTENT_TREE_OBJECTID) | ||
508 | return fs_info->extent_root; | ||
509 | |||
510 | root = radix_tree_lookup(&fs_info->fs_roots_radix, | ||
511 | (unsigned long)root_objectid); | ||
512 | return root; | ||
513 | } | ||
514 | |||
501 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | 515 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, |
502 | struct btrfs_key *location) | 516 | struct btrfs_key *location) |
503 | { | 517 | { |