diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-04-21 08:17:57 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-04-21 08:17:57 -0400 |
commit | 21f1d5fc592e145574dede8debe9603334d08fde (patch) | |
tree | 95e58363205a01dc32aa15d18ea8d36bd434d7d2 | |
parent | c569882b2e70a0c4eac99acdb39b493549041ba1 (diff) |
[RBTREE] Update JFFS2 to use rb_parent() accessor macro.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | fs/jffs2/nodelist.h | 1 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 18 |
2 files changed, 9 insertions, 10 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index 23a67bb3052f..131b67b6c350 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -299,7 +299,6 @@ static inline struct jffs2_node_frag *frag_last(struct rb_root *root) | |||
299 | return rb_entry(node, struct jffs2_node_frag, rb); | 299 | return rb_entry(node, struct jffs2_node_frag, rb); |
300 | } | 300 | } |
301 | 301 | ||
302 | #define rb_parent(rb) ((rb)->rb_parent) | ||
303 | #define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb) | 302 | #define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb) |
304 | #define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb) | 303 | #define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb) |
305 | #define frag_parent(frag) rb_entry(rb_parent(&(frag)->rb), struct jffs2_node_frag, rb) | 304 | #define frag_parent(frag) rb_entry(rb_parent(&(frag)->rb), struct jffs2_node_frag, rb) |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index f1695642d0f7..6f4a7d846e8c 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -66,7 +66,7 @@ static void jffs2_free_tmp_dnode_info_list(struct rb_root *list) | |||
66 | jffs2_free_full_dnode(tn->fn); | 66 | jffs2_free_full_dnode(tn->fn); |
67 | jffs2_free_tmp_dnode_info(tn); | 67 | jffs2_free_tmp_dnode_info(tn); |
68 | 68 | ||
69 | this = this->rb_parent; | 69 | this = rb_parent(this); |
70 | if (!this) | 70 | if (!this) |
71 | break; | 71 | break; |
72 | 72 | ||
@@ -679,12 +679,12 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, | |||
679 | jffs2_mark_node_obsolete(c, fn->raw); | 679 | jffs2_mark_node_obsolete(c, fn->raw); |
680 | 680 | ||
681 | BUG_ON(rb->rb_left); | 681 | BUG_ON(rb->rb_left); |
682 | if (rb->rb_parent && rb->rb_parent->rb_left == rb) { | 682 | if (rb_parent(rb) && rb_parent(rb)->rb_left == rb) { |
683 | /* We were then left-hand child of our parent. We need | 683 | /* We were then left-hand child of our parent. We need |
684 | * to move our own right-hand child into our place. */ | 684 | * to move our own right-hand child into our place. */ |
685 | repl_rb = rb->rb_right; | 685 | repl_rb = rb->rb_right; |
686 | if (repl_rb) | 686 | if (repl_rb) |
687 | repl_rb->rb_parent = rb->rb_parent; | 687 | rb_set_parent(repl_rb, rb_parent(rb)); |
688 | } else | 688 | } else |
689 | repl_rb = NULL; | 689 | repl_rb = NULL; |
690 | 690 | ||
@@ -692,14 +692,14 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, | |||
692 | 692 | ||
693 | /* Remove the spent tn from the tree; don't bother rebalancing | 693 | /* Remove the spent tn from the tree; don't bother rebalancing |
694 | * but put our right-hand child in our own place. */ | 694 | * but put our right-hand child in our own place. */ |
695 | if (tn->rb.rb_parent) { | 695 | if (rb_parent(&tn->rb)) { |
696 | if (tn->rb.rb_parent->rb_left == &tn->rb) | 696 | if (rb_parent(&tn->rb)->rb_left == &tn->rb) |
697 | tn->rb.rb_parent->rb_left = repl_rb; | 697 | rb_parent(&tn->rb)->rb_left = repl_rb; |
698 | else if (tn->rb.rb_parent->rb_right == &tn->rb) | 698 | else if (rb_parent(&tn->rb)->rb_right == &tn->rb) |
699 | tn->rb.rb_parent->rb_right = repl_rb; | 699 | rb_parent(&tn->rb)->rb_right = repl_rb; |
700 | else BUG(); | 700 | else BUG(); |
701 | } else if (tn->rb.rb_right) | 701 | } else if (tn->rb.rb_right) |
702 | tn->rb.rb_right->rb_parent = NULL; | 702 | rb_set_parent(tn->rb.rb_right, NULL); |
703 | 703 | ||
704 | jffs2_free_tmp_dnode_info(tn); | 704 | jffs2_free_tmp_dnode_info(tn); |
705 | if (ret) { | 705 | if (ret) { |