public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jffs2: use rb_first() and rb_last() cleanup
@ 2006-10-12  5:28 Akinobu Mita
  0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2006-10-12  5:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Woodhouse

Use rb_first() and rb_last() to implement frag_first() and frag_last().

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com>

 fs/jffs2/nodelist.h |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Index: work-fault-inject/fs/jffs2/nodelist.h
===================================================================
--- work-fault-inject.orig/fs/jffs2/nodelist.h
+++ work-fault-inject/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);
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-12  5:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12  5:28 [PATCH] jffs2: use rb_first() and rb_last() cleanup Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox