aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/disk-io.c8
-rw-r--r--fs/btrfs/disk-io.h2
-rw-r--r--fs/btrfs/super.c5
3 files changed, 5 insertions, 10 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 }
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 6f5f48778b00..e4bc4741319b 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -86,8 +86,6 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
86int btrfs_add_log_tree(struct btrfs_trans_handle *trans, 86int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
87 struct btrfs_root *root); 87 struct btrfs_root *root);
88 88
89struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info);
90
91#ifdef CONFIG_DEBUG_LOCK_ALLOC 89#ifdef CONFIG_DEBUG_LOCK_ALLOC
92void btrfs_init_lockdep(void); 90void btrfs_init_lockdep(void);
93void btrfs_set_buffer_lockdep_class(u64 objectid, 91void btrfs_set_buffer_lockdep_class(u64 objectid,
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 305adf6dc09a..044652ee7ef5 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -899,11 +899,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
899 if (!fs_info) 899 if (!fs_info)
900 return ERR_PTR(-ENOMEM); 900 return ERR_PTR(-ENOMEM);
901 901
902 fs_info->tree_root = btrfs_alloc_root(fs_info);
903 if (!fs_info->tree_root) {
904 error = -ENOMEM;
905 goto error_fs_info;
906 }
907 fs_info->fs_devices = fs_devices; 902 fs_info->fs_devices = fs_devices;
908 903
909 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_NOFS); 904 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_NOFS);