Skip to content

Commit

Permalink
ext4: fix up rb_root initializations to use RB_ROOT
Browse files Browse the repository at this point in the history
ext4 uses rb_node = NULL; to zero rb_root at few places.  Using
RB_ROOT as the initializer is more portable in case the underlying
implementation of rbtrees changes in the future.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Eric Paris <eparis@redhat.com>
  • Loading branch information
Venkatesh Pallipadi authored and Theodore Ts'o committed Mar 5, 2010
1 parent c437b27 commit 64e290e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fs/ext4/block_validity.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ void ext4_release_system_zone(struct super_block *sb)
entry = rb_entry(n, struct ext4_system_zone, node);
kmem_cache_free(ext4_system_zone_cachep, entry);
if (!parent)
EXT4_SB(sb)->system_blks.rb_node = NULL;
EXT4_SB(sb)->system_blks = RB_ROOT;
else if (parent->rb_left == n)
parent->rb_left = NULL;
else if (parent->rb_right == n)
parent->rb_right = NULL;
n = parent;
}
EXT4_SB(sb)->system_blks.rb_node = NULL;
EXT4_SB(sb)->system_blks = RB_ROOT;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static void free_rb_tree_fname(struct rb_root *root)
kfree(old);
}
if (!parent)
root->rb_node = NULL;
*root = RB_ROOT;
else if (parent->rb_left == n)
parent->rb_left = NULL;
else if (parent->rb_right == n)
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,

INIT_LIST_HEAD(&meta_group_info[i]->bb_prealloc_list);
init_rwsem(&meta_group_info[i]->alloc_sem);
meta_group_info[i]->bb_free_root.rb_node = NULL;
meta_group_info[i]->bb_free_root = RB_ROOT;

#ifdef DOUBLE_CHECK
{
Expand Down

0 comments on commit 64e290e

Please sign in to comment.