Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bef4d31 authored by Eric Paris's avatar Eric Paris Committed by Chris Mason
Browse files

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 17d9ddc7 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: default avatarEric Paris <eparis@redhat.com>
Acked-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 3f6fae95
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
	root->highest_objectid = 0;
	root->name = NULL;
	root->in_sysfs = 0;
	root->inode_tree.rb_node = NULL;
	root->inode_tree = RB_ROOT;

	INIT_LIST_HEAD(&root->dirty_list);
	INIT_LIST_HEAD(&root->orphan_list);
@@ -1673,7 +1673,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
	insert_inode_hash(fs_info->btree_inode);

	spin_lock_init(&fs_info->block_group_cache_lock);
	fs_info->block_group_cache_tree.rb_node = NULL;
	fs_info->block_group_cache_tree = RB_ROOT;

	extent_io_tree_init(&fs_info->freed_extents[0],
			     fs_info->btree_inode->i_mapping, GFP_NOFS);
+2 −2
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ void extent_io_exit(void)
void extent_io_tree_init(struct extent_io_tree *tree,
			  struct address_space *mapping, gfp_t mask)
{
	tree->state.rb_node = NULL;
	tree->buffer.rb_node = NULL;
	tree->state = RB_ROOT;
	tree->buffer = RB_ROOT;
	tree->ops = NULL;
	tree->dirty_bytes = 0;
	spin_lock_init(&tree->lock);
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ void extent_map_exit(void)
 */
void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask)
{
	tree->map.rb_node = NULL;
	tree->map = RB_ROOT;
	rwlock_init(&tree->lock);
}

+2 −2
Original line number Diff line number Diff line
@@ -870,7 +870,7 @@ __btrfs_return_cluster_to_free_space(
		tree_insert_offset(&block_group->free_space_offset,
				   entry->offset, &entry->offset_index, 0);
	}
	cluster->root.rb_node = NULL;
	cluster->root = RB_ROOT;

out:
	spin_unlock(&cluster->lock);
@@ -1355,7 +1355,7 @@ void btrfs_init_free_cluster(struct btrfs_free_cluster *cluster)
{
	spin_lock_init(&cluster->lock);
	spin_lock_init(&cluster->refill_lock);
	cluster->root.rb_node = NULL;
	cluster->root = RB_ROOT;
	cluster->max_size = 0;
	cluster->points_to_bitmap = false;
	INIT_LIST_HEAD(&cluster->block_group_list);
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ static inline void
btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t)
{
	mutex_init(&t->mutex);
	t->tree.rb_node = NULL;
	t->tree = RB_ROOT;
	t->last = NULL;
}

Loading