[JFFS2] Use rb_first() and rb_last() cleanup

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Oct 21 11:59:02 EDT 2006


Commit:     ea7415cca922389b4f3c0cf75e0af9fbf827880e
Parent:     29175778b07aa60e7f8030bd95d69f70070cc1f7
commit ea7415cca922389b4f3c0cf75e0af9fbf827880e
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Fri Oct 20 14:41:05 2006 -0700
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat Oct 21 16:21:40 2006 +0100

    [JFFS2] Use rb_first() and rb_last() cleanup
    
    Use rb_first() and rb_last() to implement frag_first() and frag_last().
    
    Signed-off-by: Akinbou Mita <akinobu.mita at gmail.com>
    Signed-off-by: Andrew Morton <akpm at osdl.org>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 fs/jffs2/nodelist.h |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 0ddfd70..4178b4b 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -294,23 +294,21 @@ static inline int jffs2_encode_dev(union
 
 static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
 {
-	struct rb_node *node = root->rb_node;
+	struct rb_node *node = rb_first(root);
 
 	if (!node)
 		return NULL;
-	while(node->rb_left)
-		node = node->rb_left;
+
 	return rb_entry(node, struct jffs2_node_frag, rb);
 }
 
 static inline struct jffs2_node_frag *frag_last(struct rb_root *root)
 {
-	struct rb_node *node = root->rb_node;
+	struct rb_node *node = rb_last(root);
 
 	if (!node)
 		return NULL;
-	while(node->rb_right)
-		node = node->rb_right;
+
 	return rb_entry(node, struct jffs2_node_frag, rb);
 }
 



More information about the linux-mtd-cvs mailing list