Is it valid to do the following
struct foo {
int data;
struct rb_node node
};
struct rb_root root;
/* Filling tree with kalloc'ed foo nodes */
struct rb_node *node=rb_first(&root);
while (node)
{
struct rb_node *next=rb_next(node);
kfree(node);
node = next;
}
root=RB_ROOT;
In fact, I just want do foreach and clear at same time with linear time.
Explored rb_next implementation. It returns parent before right children.
So, It is impossible to clear list this way.