aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2013-12-16 13:24:27 -0500
committerChris Mason <clm@fb.com>2014-01-28 16:19:55 -0500
commitf28491e0a6c46d99cbbef0f8ef7e314afa2359c8 (patch)
tree4a64b0042fbdd784a4dd2e038d9e3833f69bab7a /fs/btrfs/disk-io.c
parent34b41acec1ccc06373ec584de19618d48ceb09fc (diff)
Btrfs: move the extent buffer radix tree into the fs_info
I need to create a fake tree to test qgroups and I don't want to have to setup a fake btree_inode. The fact is we only use the radix tree for the fs_info, so everybody else who allocates an extent_io_tree is just wasting the space anyway. This patch moves the radix tree and its lock into btrfs_fs_info so there is less stuff I have to fake to do qgroup sanity tests. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4ecee0a009cb..4a1871cf797b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1089,21 +1089,13 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize,
1089struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, 1089struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
1090 u64 bytenr, u32 blocksize) 1090 u64 bytenr, u32 blocksize)
1091{ 1091{
1092 struct inode *btree_inode = root->fs_info->btree_inode; 1092 return find_extent_buffer(root->fs_info, bytenr);
1093 struct extent_buffer *eb;
1094 eb = find_extent_buffer(&BTRFS_I(btree_inode)->io_tree, bytenr);
1095 return eb;
1096} 1093}
1097 1094
1098struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, 1095struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
1099 u64 bytenr, u32 blocksize) 1096 u64 bytenr, u32 blocksize)
1100{ 1097{
1101 struct inode *btree_inode = root->fs_info->btree_inode; 1098 return alloc_extent_buffer(root->fs_info, bytenr, blocksize);
1102 struct extent_buffer *eb;
1103
1104 eb = alloc_extent_buffer(&BTRFS_I(btree_inode)->io_tree,
1105 bytenr, blocksize);
1106 return eb;
1107} 1099}
1108 1100
1109 1101
@@ -2145,6 +2137,7 @@ int open_ctree(struct super_block *sb,
2145 mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS); 2137 mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS);
2146 2138
2147 INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_ATOMIC); 2139 INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_ATOMIC);
2140 INIT_RADIX_TREE(&fs_info->buffer_radix, GFP_ATOMIC);
2148 INIT_LIST_HEAD(&fs_info->trans_list); 2141 INIT_LIST_HEAD(&fs_info->trans_list);
2149 INIT_LIST_HEAD(&fs_info->dead_roots); 2142 INIT_LIST_HEAD(&fs_info->dead_roots);
2150 INIT_LIST_HEAD(&fs_info->delayed_iputs); 2143 INIT_LIST_HEAD(&fs_info->delayed_iputs);
@@ -2158,6 +2151,7 @@ int open_ctree(struct super_block *sb,
2158 spin_lock_init(&fs_info->free_chunk_lock); 2151 spin_lock_init(&fs_info->free_chunk_lock);
2159 spin_lock_init(&fs_info->tree_mod_seq_lock); 2152 spin_lock_init(&fs_info->tree_mod_seq_lock);
2160 spin_lock_init(&fs_info->super_lock); 2153 spin_lock_init(&fs_info->super_lock);
2154 spin_lock_init(&fs_info->buffer_lock);
2161 rwlock_init(&fs_info->tree_mod_log_lock); 2155 rwlock_init(&fs_info->tree_mod_log_lock);
2162 mutex_init(&fs_info->reloc_mutex); 2156 mutex_init(&fs_info->reloc_mutex);
2163 seqlock_init(&fs_info->profiles_lock); 2157 seqlock_init(&fs_info->profiles_lock);