/* walk up backref nodes until reach node presents tree root  */
static struct backref_node* walk_up_backref(struct backref_node *node, struct backref_edge *edges[], int *index)
/* walk up backref nodes until reach node presents tree root  */
static struct backref_node* walk_up_backref(struct backref_node *node, struct backref_edge *edges[], int *index)
{
	struct backref_edge *edge;
	int idx = *index;
	while (!list_empty(&node->upper)) {
		edge = list_entry(node->upper.next,
				  struct backref_edge, list[LOWER]);
		edges[idx++] = edge;
		node = edge->node[UPPER];
	}
	*index = idx;
	return node;
}