diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 009e3bd18f23..0427183e3e05 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -901,7 +901,7 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
901 | root->highest_objectid = 0; | 901 | root->highest_objectid = 0; |
902 | root->name = NULL; | 902 | root->name = NULL; |
903 | root->in_sysfs = 0; | 903 | root->in_sysfs = 0; |
904 | root->inode_tree.rb_node = NULL; | 904 | root->inode_tree = RB_ROOT; |
905 | 905 | ||
906 | INIT_LIST_HEAD(&root->dirty_list); | 906 | INIT_LIST_HEAD(&root->dirty_list); |
907 | INIT_LIST_HEAD(&root->orphan_list); | 907 | INIT_LIST_HEAD(&root->orphan_list); |
@@ -1673,7 +1673,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1673 | insert_inode_hash(fs_info->btree_inode); | 1673 | insert_inode_hash(fs_info->btree_inode); |
1674 | 1674 | ||
1675 | spin_lock_init(&fs_info->block_group_cache_lock); | 1675 | spin_lock_init(&fs_info->block_group_cache_lock); |
1676 | fs_info->block_group_cache_tree.rb_node = NULL; | 1676 | fs_info->block_group_cache_tree = RB_ROOT; |
1677 | 1677 | ||
1678 | extent_io_tree_init(&fs_info->freed_extents[0], | 1678 | extent_io_tree_init(&fs_info->freed_extents[0], |
1679 | fs_info->btree_inode->i_mapping, GFP_NOFS); | 1679 | fs_info->btree_inode->i_mapping, GFP_NOFS); |
@@ -1982,7 +1982,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1982 | 1982 | ||
1983 | if (!(sb->s_flags & MS_RDONLY)) { | 1983 | if (!(sb->s_flags & MS_RDONLY)) { |
1984 | ret = btrfs_recover_relocation(tree_root); | 1984 | ret = btrfs_recover_relocation(tree_root); |
1985 | BUG_ON(ret); | 1985 | if (ret < 0) { |
1986 | printk(KERN_WARNING | ||
1987 | "btrfs: failed to recover relocation\n"); | ||
1988 | err = -EINVAL; | ||
1989 | goto fail_trans_kthread; | ||
1990 | } | ||
1986 | } | 1991 | } |
1987 | 1992 | ||
1988 | location.objectid = BTRFS_FS_TREE_OBJECTID; | 1993 | location.objectid = BTRFS_FS_TREE_OBJECTID; |
@@ -1993,6 +1998,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1993 | if (!fs_info->fs_root) | 1998 | if (!fs_info->fs_root) |
1994 | goto fail_trans_kthread; | 1999 | goto fail_trans_kthread; |
1995 | 2000 | ||
2001 | if (!(sb->s_flags & MS_RDONLY)) { | ||
2002 | down_read(&fs_info->cleanup_work_sem); | ||
2003 | btrfs_orphan_cleanup(fs_info->fs_root); | ||
2004 | up_read(&fs_info->cleanup_work_sem); | ||
2005 | } | ||
2006 | |||
1996 | return tree_root; | 2007 | return tree_root; |
1997 | 2008 | ||
1998 | fail_trans_kthread: | 2009 | fail_trans_kthread: |