Skip to content

Commit

Permalink
[JFFS2] Use rb_first() and rb_last() cleanup
Browse files Browse the repository at this point in the history
Use rb_first() and rb_last() to implement frag_first() and frag_last().

Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Akinobu Mita authored and David Woodhouse committed Oct 21, 2006
1 parent 2917577 commit ea7415c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/jffs2/nodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,23 +294,21 @@ static inline int jffs2_encode_dev(union jffs2_device_node *jdev, dev_t rdev)

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);
}

Expand Down

0 comments on commit ea7415c

Please sign in to comment.