aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/readinode.c
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-10-08 19:30:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:32 -0400
commitbf7ad8eeab995710c766df49c9c69a8592ca0216 (patch)
tree737988d677b8ea408a44a58a949cc0e8eda02440 /fs/jffs2/readinode.c
parentea5272f5c94fb2ee62f4f15a5b88eef6184cd506 (diff)
rbtree: move some implementation details from rbtree.h to rbtree.c
rbtree users must use the documented APIs to manipulate the tree structure. Low-level helpers to manipulate node colors and parenthood are not part of that API, so move them to lib/rbtree.c [dwmw2@infradead.org: fix jffs2 build issue due to renamed __rb_parent_color field] Signed-off-by: Michel Lespinasse <walken@google.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Acked-by: David Woodhouse <David.Woodhouse@intel.com> Cc: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Daniel Santos <daniel.santos@pobox.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jffs2/readinode.c')
-rw-r--r--fs/jffs2/readinode.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 1ea349fff68b..ae81b01e6fd7 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -394,8 +394,11 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
394} 394}
395 395
396/* Trivial function to remove the last node in the tree. Which by definition 396/* Trivial function to remove the last node in the tree. Which by definition
397 has no right-hand -- so can be removed just by making its only child (if 397 has no right-hand child — so can be removed just by making its left-hand
398 any) take its place under its parent. */ 398 child (if any) take its place under its parent. Since this is only done
399 when we're consuming the whole tree, there's no need to use rb_erase()
400 and let it worry about adjusting colours and balancing the tree. That
401 would just be a waste of time. */
399static void eat_last(struct rb_root *root, struct rb_node *node) 402static void eat_last(struct rb_root *root, struct rb_node *node)
400{ 403{
401 struct rb_node *parent = rb_parent(node); 404 struct rb_node *parent = rb_parent(node);
@@ -412,12 +415,12 @@ static void eat_last(struct rb_root *root, struct rb_node *node)
412 link = &parent->rb_right; 415 link = &parent->rb_right;
413 416
414 *link = node->rb_left; 417 *link = node->rb_left;
415 /* Colour doesn't matter now. Only the parent pointer. */
416 if (node->rb_left) 418 if (node->rb_left)
417 node->rb_left->rb_parent_color = node->rb_parent_color; 419 node->rb_left->__rb_parent_color = node->__rb_parent_color;
418} 420}
419 421
420/* We put this in reverse order, so we can just use eat_last */ 422/* We put the version tree in reverse order, so we can use the same eat_last()
423 function that we use to consume the tmpnode tree (tn_root). */
421static void ver_insert(struct rb_root *ver_root, struct jffs2_tmp_dnode_info *tn) 424static void ver_insert(struct rb_root *ver_root, struct jffs2_tmp_dnode_info *tn)
422{ 425{
423 struct rb_node **link = &ver_root->rb_node; 426 struct rb_node **link = &ver_root->rb_node;