aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f7d8b9ba519b..dd71be875939 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1215,7 +1215,7 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
1215 return 0; 1215 return 0;
1216} 1216}
1217 1217
1218struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info) 1218static struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info)
1219{ 1219{
1220 struct btrfs_root *root = kzalloc(sizeof(*root), GFP_NOFS); 1220 struct btrfs_root *root = kzalloc(sizeof(*root), GFP_NOFS);
1221 if (root) 1221 if (root)
@@ -1895,7 +1895,7 @@ int open_ctree(struct super_block *sb,
1895 struct buffer_head *bh; 1895 struct buffer_head *bh;
1896 struct btrfs_super_block *disk_super; 1896 struct btrfs_super_block *disk_super;
1897 struct btrfs_fs_info *fs_info = btrfs_sb(sb); 1897 struct btrfs_fs_info *fs_info = btrfs_sb(sb);
1898 struct btrfs_root *tree_root = fs_info->tree_root; 1898 struct btrfs_root *tree_root;
1899 struct btrfs_root *extent_root; 1899 struct btrfs_root *extent_root;
1900 struct btrfs_root *csum_root; 1900 struct btrfs_root *csum_root;
1901 struct btrfs_root *chunk_root; 1901 struct btrfs_root *chunk_root;
@@ -1906,12 +1906,14 @@ int open_ctree(struct super_block *sb,
1906 int num_backups_tried = 0; 1906 int num_backups_tried = 0;
1907 int backup_index = 0; 1907 int backup_index = 0;
1908 1908
1909 tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info);
1909 extent_root = fs_info->extent_root = btrfs_alloc_root(fs_info); 1910 extent_root = fs_info->extent_root = btrfs_alloc_root(fs_info);
1910 csum_root = fs_info->csum_root = btrfs_alloc_root(fs_info); 1911 csum_root = fs_info->csum_root = btrfs_alloc_root(fs_info);
1911 chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info); 1912 chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info);
1912 dev_root = fs_info->dev_root = btrfs_alloc_root(fs_info); 1913 dev_root = fs_info->dev_root = btrfs_alloc_root(fs_info);
1913 1914
1914 if (!extent_root || !csum_root || !chunk_root || !dev_root) { 1915 if (!tree_root || !extent_root || !csum_root ||
1916 !chunk_root || !dev_root) {
1915 err = -ENOMEM; 1917 err = -ENOMEM;
1916 goto fail; 1918 goto fail;
1917 } 1919 }