linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/3] Fixup rb_root initializations to use RB_ROOT
@ 2010-02-24  1:38 venkatesh.pallipadi
  2010-02-24  1:38 ` [patch 1/3] ext4: " venkatesh.pallipadi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: venkatesh.pallipadi @ 2010-02-24  1:38 UTC (permalink / raw)
  To: Ingo Molnar, H Peter Anvin, Thomas Gleixner, David Woodhouse,
	Andrew Morton, Theodore Ts'o, Andreas Dilger, Eric Paris
  Cc: Venkatesh Pallipadi, Suresh Siddha, linux-kernel

Eric Paris found a problem with rb_root initializations and sent a patch to
fix it here:
http://lkml.indiana.edu/hypermail/linux/kernel/1002.2/02946.html
btrfs: use RB_ROOT to intialize rb_trees instead of setting rb_node to NULL

Based on that, a simple grep for "rb_node = NULL" showed few more similar
usages in ext3, ext4 and jffs2. Here are the patches to fix those
root.rb_node = NULL
usages to
root = RB_ROOT

Compile tested.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

-- 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [patch 1/3] ext4: Fixup rb_root initializations to use RB_ROOT
  2010-02-24  1:38 [patch 0/3] Fixup rb_root initializations to use RB_ROOT venkatesh.pallipadi
@ 2010-02-24  1:38 ` venkatesh.pallipadi
  2010-02-24 23:06   ` Andrew Morton
  2010-02-24  1:39 ` [patch 2/3] ext3: " venkatesh.pallipadi
  2010-02-24  1:39 ` [patch 3/3] jffs2: " venkatesh.pallipadi
  2 siblings, 1 reply; 5+ messages in thread
From: venkatesh.pallipadi @ 2010-02-24  1:38 UTC (permalink / raw)
  To: Ingo Molnar, H Peter Anvin, Thomas Gleixner, Theodore Ts'o,
	Andreas Dilger, Eric Paris
  Cc: Venkatesh Pallipadi, Suresh Siddha, linux-kernel

[-- Attachment #1: 0001-ext4-fix.patch --]
[-- Type: text/plain, Size: 2028 bytes --]

ext4 uses rb_node = NULL; to zero rb_root at few places.
The problem with this is that 17d9ddc72fb8bba0d4f678 in the
linux-next tree adds a new field to that struct which needs to be NULLas well.
This patch uses RB_ROOT as the intializer so all of the relevant fields will
be NULL'd.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 fs/ext4/block_validity.c |    4 ++--
 fs/ext4/dir.c            |    2 +-
 fs/ext4/mballoc.c        |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index a60ab9a..983f0e1 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -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;
 }
 
 /*
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 9dc9316..6bdb566 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -303,7 +303,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)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d34afad..ba1d99d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2256,7 +2256,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
 	{
-- 
1.6.0.6

-- 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [patch 2/3] ext3: Fixup rb_root initializations to use RB_ROOT
  2010-02-24  1:38 [patch 0/3] Fixup rb_root initializations to use RB_ROOT venkatesh.pallipadi
  2010-02-24  1:38 ` [patch 1/3] ext4: " venkatesh.pallipadi
@ 2010-02-24  1:39 ` venkatesh.pallipadi
  2010-02-24  1:39 ` [patch 3/3] jffs2: " venkatesh.pallipadi
  2 siblings, 0 replies; 5+ messages in thread
From: venkatesh.pallipadi @ 2010-02-24  1:39 UTC (permalink / raw)
  To: Ingo Molnar, H Peter Anvin, Thomas Gleixner, Andrew Morton,
	Andreas Dilger, Eric Paris, mingo
  Cc: Venkatesh Pallipadi, Suresh Siddha, linux-kernel, linux-kernel,
	Venkatesh Pallipadi

[-- Attachment #1: 0002-ext3-fix.patch --]
[-- Type: text/plain, Size: 804 bytes --]

ext3 uses rb_node = NULL; to zero rb_root.
The problem with this is that 17d9ddc72fb8bba0d4f678 in the
linux-next tree adds a new field to that struct which needs to be NULLas well.
This patch uses RB_ROOT as the intializer so all of the relevant fields will
be NULL'd.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 fs/ext3/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 373fa90..e2e72c3 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -297,7 +297,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)
-- 
1.6.0.6

-- 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [patch 3/3] jffs2: Fixup rb_root initializations to use RB_ROOT
  2010-02-24  1:38 [patch 0/3] Fixup rb_root initializations to use RB_ROOT venkatesh.pallipadi
  2010-02-24  1:38 ` [patch 1/3] ext4: " venkatesh.pallipadi
  2010-02-24  1:39 ` [patch 2/3] ext3: " venkatesh.pallipadi
@ 2010-02-24  1:39 ` venkatesh.pallipadi
  2 siblings, 0 replies; 5+ messages in thread
From: venkatesh.pallipadi @ 2010-02-24  1:39 UTC (permalink / raw)
  To: Ingo Molnar, H Peter Anvin, Thomas Gleixner, David Woodhouse, Eric Paris
  Cc: Venkatesh Pallipadi, Suresh Siddha, linux-kernel

[-- Attachment #1: 0003-jffs2-fix.patch --]
[-- Type: text/plain, Size: 814 bytes --]

jffs2 uses rb_node = NULL; to zero rb_root.
The problem with this is that 17d9ddc72fb8bba0d4f678 in the
linux-next tree adds a new field to that struct which needs to be NULLas well.
This patch uses RB_ROOT as the intializer so all of the relevant fields will
be NULL'd.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 fs/jffs2/readinode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index e22de83..d32ee94 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -567,7 +567,7 @@ static void jffs2_free_tmp_dnode_info_list(struct rb_root *list)
 			else BUG();
 		}
 	}
-	list->rb_node = NULL;
+	*list = RB_ROOT;
 }
 
 static void jffs2_free_full_dirent_list(struct jffs2_full_dirent *fd)
-- 
1.6.0.6

-- 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch 1/3] ext4: Fixup rb_root initializations to use RB_ROOT
  2010-02-24  1:38 ` [patch 1/3] ext4: " venkatesh.pallipadi
@ 2010-02-24 23:06   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2010-02-24 23:06 UTC (permalink / raw)
  To: venkatesh.pallipadi
  Cc: Ingo Molnar, H Peter Anvin, Thomas Gleixner, Theodore Ts'o,
	Andreas Dilger, Eric Paris, Suresh Siddha, linux-kernel

On Tue, 23 Feb 2010 17:38:59 -0800 venkatesh.pallipadi@intel.com wrote:

> The problem with this is that 17d9ddc72fb8bba0d4f678 in the
> linux-next tree

Please don't quote bare commit ID's in changelogs.  Especially when
it's a linux-next commit: linux-next gets rebuilt each day!

The preferred form is to quote the title as well:
17d9ddc72fb8bba0d4f678 ("rbtree: Add support for augmented rbtrees") 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-24 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-24  1:38 [patch 0/3] Fixup rb_root initializations to use RB_ROOT venkatesh.pallipadi
2010-02-24  1:38 ` [patch 1/3] ext4: " venkatesh.pallipadi
2010-02-24 23:06   ` Andrew Morton
2010-02-24  1:39 ` [patch 2/3] ext3: " venkatesh.pallipadi
2010-02-24  1:39 ` [patch 3/3] jffs2: " venkatesh.pallipadi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).