Lines Matching refs:rb
21 struct rb_node rb; member
40 if (key < rb_entry(parent, struct test_node, rb)->key) in insert()
46 rb_link_node(&node->rb, parent, new); in insert()
47 rb_insert_color(&node->rb, &root->rb_root); in insert()
58 if (key < rb_entry(parent, struct test_node, rb)->key) in insert_cached()
66 rb_link_node(&node->rb, parent, new); in insert_cached()
67 rb_insert_color_cached(&node->rb, root, leftmost); in insert_cached()
72 rb_erase(&node->rb, &root->rb_root); in erase()
77 rb_erase_cached(&node->rb, root); in erase_cached()
84 struct test_node, rb, u32, augmented, NODE_VAL) in RB_DECLARE_CALLBACKS_MAX() argument
96 parent = rb_entry(rb_parent, struct test_node, rb); in RB_DECLARE_CALLBACKS_MAX()
100 new = &parent->rb.rb_left; in RB_DECLARE_CALLBACKS_MAX()
102 new = &parent->rb.rb_right; in RB_DECLARE_CALLBACKS_MAX()
106 rb_link_node(&node->rb, rb_parent, new); in RB_DECLARE_CALLBACKS_MAX()
107 rb_insert_augmented(&node->rb, &root->rb_root, &augment_callbacks); in RB_DECLARE_CALLBACKS_MAX()
121 parent = rb_entry(rb_parent, struct test_node, rb); in insert_augmented_cached()
125 new = &parent->rb.rb_left; in insert_augmented_cached()
127 new = &parent->rb.rb_right; in insert_augmented_cached()
133 rb_link_node(&node->rb, rb_parent, new); in insert_augmented_cached()
134 rb_insert_augmented_cached(&node->rb, root, in insert_augmented_cached()
141 rb_erase_augmented(&node->rb, &root->rb_root, &augment_callbacks); in erase_augmented()
147 rb_erase_augmented_cached(&node->rb, root, &augment_callbacks); in erase_augmented_cached()
159 static bool is_red(struct rb_node *rb) in is_red() argument
161 return !(rb->__rb_parent_color & 1); in is_red()
164 static int black_path_count(struct rb_node *rb) in black_path_count() argument
167 for (count = 0; rb; rb = rb_parent(rb)) in black_path_count()
168 count += !is_red(rb); in black_path_count()
176 rbtree_postorder_for_each_entry_safe(cur, n, &root.rb_root, rb) in check_postorder_foreach()
184 struct rb_node *rb; in check_postorder() local
186 for (rb = rb_first_postorder(&root.rb_root); rb; rb = rb_next_postorder(rb)) in check_postorder()
194 struct rb_node *rb; in check() local
198 for (rb = rb_first(&root.rb_root); rb; rb = rb_next(rb)) { in check()
199 struct test_node *node = rb_entry(rb, struct test_node, rb); in check()
201 WARN_ON_ONCE(is_red(rb) && in check()
202 (!rb_parent(rb) || is_red(rb_parent(rb)))); in check()
204 blacks = black_path_count(rb); in check()
206 WARN_ON_ONCE((!rb->rb_left || !rb->rb_right) && in check()
207 blacks != black_path_count(rb)); in check()
221 struct rb_node *rb; in check_augmented() local
224 for (rb = rb_first(&root.rb_root); rb; rb = rb_next(rb)) { in check_augmented()
225 struct test_node *node = rb_entry(rb, struct test_node, rb); in check_augmented()
227 if (node->rb.rb_left) { in check_augmented()
228 subtree = rb_entry(node->rb.rb_left, struct test_node, in check_augmented()
229 rb)->augmented; in check_augmented()
233 if (node->rb.rb_right) { in check_augmented()
234 subtree = rb_entry(node->rb.rb_right, struct test_node, in check_augmented()
235 rb)->augmented; in check_augmented()