/* Scan for the next right leaf starting at node p->child Since we have back pointer, no recursion necessary.  */
static struct leaf* leaf_walk_rcu(struct tnode *p, struct node *c)
/* Scan for the next right leaf starting at node p->child Since we have back pointer, no recursion necessary.  */
static struct leaf* leaf_walk_rcu(struct tnode *p, struct node *c)
{
	do {
		t_key idx;
		if (c)
			idx = tkey_extract_bits(c->key, p->pos, p->bits) + 1;
		else
			idx = 0;
		while (idx < 1u << p->bits) {
			c = tnode_get_child_rcu(p, idx++);
			if (!c)
				continue;
			if (IS_LEAF(c)) {
				prefetch(p->child[idx]);
				return (struct leaf *) c;
			}
			p = (struct tnode *) c;
			idx = 0;
		}
		c = (struct node *) p;
	} while ( (p = node_parent_rcu(c)) != NULL);
	return NULL;
}