aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-02-23 14:43:04 -0500
committerChris Mason <chris.mason@oracle.com>2010-03-08 16:26:50 -0500
commit6bef4d317193d3badbbfa3f3c593758ace84a629 (patch)
tree8aa9fcf3297c69033b9a9a83a27ecccaab0f9d7d /fs/btrfs
parent3f6fae9559225741c91f1320090b285da1413290 (diff)
Btrfs: use RB_ROOT to intialize rb_trees instead of setting rb_node to NULL
btrfs inialize rb trees in quite a number of places by settin rb_node = NULL; The problem with this is that 17d9ddc72fb8bba0d4f678 in the linux-next tree adds a new field to that struct which needs to be NULL for the new rbtree library code to work properly. This patch uses RB_ROOT as the intializer so all of the relevant fields will be NULL'd. Without the patch I get a panic. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/disk-io.c4
-rw-r--r--fs/btrfs/extent_io.c4
-rw-r--r--fs/btrfs/extent_map.c2
-rw-r--r--fs/btrfs/free-space-cache.c4
-rw-r--r--fs/btrfs/ordered-data.h2
-rw-r--r--fs/btrfs/ref-cache.h2
-rw-r--r--fs/btrfs/relocation.c4
-rw-r--r--fs/btrfs/transaction.c2
8 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 2b59201b955c..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);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b177ed319612..7073cbb1b2d4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -104,8 +104,8 @@ void extent_io_exit(void)
104void extent_io_tree_init(struct extent_io_tree *tree, 104void extent_io_tree_init(struct extent_io_tree *tree,
105 struct address_space *mapping, gfp_t mask) 105 struct address_space *mapping, gfp_t mask)
106{ 106{
107 tree->state.rb_node = NULL; 107 tree->state = RB_ROOT;
108 tree->buffer.rb_node = NULL; 108 tree->buffer = RB_ROOT;
109 tree->ops = NULL; 109 tree->ops = NULL;
110 tree->dirty_bytes = 0; 110 tree->dirty_bytes = 0;
111 spin_lock_init(&tree->lock); 111 spin_lock_init(&tree->lock);
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 5a4f73b79b75..5a01f35507dd 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -35,7 +35,7 @@ void extent_map_exit(void)
35 */ 35 */
36void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask) 36void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask)
37{ 37{
38 tree->map.rb_node = NULL; 38 tree->map = RB_ROOT;
39 rwlock_init(&tree->lock); 39 rwlock_init(&tree->lock);
40} 40}
41 41
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index cb2849f03251..dd831ed31eea 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -870,7 +870,7 @@ __btrfs_return_cluster_to_free_space(
870 tree_insert_offset(&block_group->free_space_offset, 870 tree_insert_offset(&block_group->free_space_offset,
871 entry->offset, &entry->offset_index, 0); 871 entry->offset, &entry->offset_index, 0);
872 } 872 }
873 cluster->root.rb_node = NULL; 873 cluster->root = RB_ROOT;
874 874
875out: 875out:
876 spin_unlock(&cluster->lock); 876 spin_unlock(&cluster->lock);
@@ -1355,7 +1355,7 @@ void btrfs_init_free_cluster(struct btrfs_free_cluster *cluster)
1355{ 1355{
1356 spin_lock_init(&cluster->lock); 1356 spin_lock_init(&cluster->lock);
1357 spin_lock_init(&cluster->refill_lock); 1357 spin_lock_init(&cluster->refill_lock);
1358 cluster->root.rb_node = NULL; 1358 cluster->root = RB_ROOT;
1359 cluster->max_size = 0; 1359 cluster->max_size = 0;
1360 cluster->points_to_bitmap = false; 1360 cluster->points_to_bitmap = false;
1361 INIT_LIST_HEAD(&cluster->block_group_list); 1361 INIT_LIST_HEAD(&cluster->block_group_list);
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 1fe1282ef47c..9116c6d0c5a9 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -129,7 +129,7 @@ static inline void
129btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t) 129btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t)
130{ 130{
131 mutex_init(&t->mutex); 131 mutex_init(&t->mutex);
132 t->tree.rb_node = NULL; 132 t->tree = RB_ROOT;
133 t->last = NULL; 133 t->last = NULL;
134} 134}
135 135
diff --git a/fs/btrfs/ref-cache.h b/fs/btrfs/ref-cache.h
index bc283ad2db73..e2a55cb2072b 100644
--- a/fs/btrfs/ref-cache.h
+++ b/fs/btrfs/ref-cache.h
@@ -52,7 +52,7 @@ static inline size_t btrfs_leaf_ref_size(int nr_extents)
52 52
53static inline void btrfs_leaf_ref_tree_init(struct btrfs_leaf_ref_tree *tree) 53static inline void btrfs_leaf_ref_tree_init(struct btrfs_leaf_ref_tree *tree)
54{ 54{
55 tree->root.rb_node = NULL; 55 tree->root = RB_ROOT;
56 INIT_LIST_HEAD(&tree->list); 56 INIT_LIST_HEAD(&tree->list);
57 spin_lock_init(&tree->lock); 57 spin_lock_init(&tree->lock);
58} 58}
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index ab7ab5318745..0109e5606bad 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -170,14 +170,14 @@ struct async_merge {
170 170
171static void mapping_tree_init(struct mapping_tree *tree) 171static void mapping_tree_init(struct mapping_tree *tree)
172{ 172{
173 tree->rb_root.rb_node = NULL; 173 tree->rb_root = RB_ROOT;
174 spin_lock_init(&tree->lock); 174 spin_lock_init(&tree->lock);
175} 175}
176 176
177static void backref_cache_init(struct backref_cache *cache) 177static void backref_cache_init(struct backref_cache *cache)
178{ 178{
179 int i; 179 int i;
180 cache->rb_root.rb_node = NULL; 180 cache->rb_root = RB_ROOT;
181 for (i = 0; i < BTRFS_MAX_LEVEL; i++) 181 for (i = 0; i < BTRFS_MAX_LEVEL; i++)
182 INIT_LIST_HEAD(&cache->pending[i]); 182 INIT_LIST_HEAD(&cache->pending[i]);
183 spin_lock_init(&cache->lock); 183 spin_lock_init(&cache->lock);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index b2acc79f1b34..2a36e236a492 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -69,7 +69,7 @@ static noinline int join_transaction(struct btrfs_root *root)
69 cur_trans->commit_done = 0; 69 cur_trans->commit_done = 0;
70 cur_trans->start_time = get_seconds(); 70 cur_trans->start_time = get_seconds();
71 71
72 cur_trans->delayed_refs.root.rb_node = NULL; 72 cur_trans->delayed_refs.root = RB_ROOT;
73 cur_trans->delayed_refs.num_entries = 0; 73 cur_trans->delayed_refs.num_entries = 0;
74 cur_trans->delayed_refs.num_heads_ready = 0; 74 cur_trans->delayed_refs.num_heads_ready = 0;
75 cur_trans->delayed_refs.num_heads = 0; 75 cur_trans->delayed_refs.num_heads = 0;