/* walk down backref nodes to find start of next reference path  */
static struct backref_node* walk_down_backref(struct backref_edge *edges[], int *index)
/* walk down backref nodes to find start of next reference path  */
static struct backref_node* walk_down_backref(struct backref_edge *edges[], int *index)
{
	struct backref_edge *edge;
	struct backref_node *lower;
	int idx = *index;
	while (idx > 0) {
		edge = edges[idx - 1];
		lower = edge->node[LOWER];
		if (list_is_last(&edge->list[LOWER], &lower->upper)) {
			idx--;
			continue;
		}
		edge = list_entry(edge->list[LOWER].next,
				  struct backref_edge, list[LOWER]);
		edges[idx - 1] = edge;
		*index = idx;
		return edge->node[UPPER];
	}
	*index = 0;
	return NULL;
}