scoutfs: fix ring next/prev

The ring node rb walker was returning an exact match for the search key
instead of the last node that was traversed.  This stopped callers from
then iterating from the traversed node to find the next or previous
node.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-05-16 10:48:11 -07:00
parent 723e0368f8
commit 66dd35b9a5
+3 -2
View File
@@ -178,7 +178,7 @@ static struct ring_node *ring_rb_walk(struct scoutfs_ring_info *ring,
struct rb_node **node = &ring->rb_root.rb_node;
struct rb_node *parent = NULL;
struct ring_node *found = NULL;
struct ring_node *rnode;
struct ring_node *rnode = NULL;
/* only provide one or the other */
BUG_ON(!!key == !!data);
@@ -213,9 +213,10 @@ static struct ring_node *ring_rb_walk(struct scoutfs_ring_info *ring,
rb_insert_color(&ins->rb_node, &ring->rb_root);
}
found = ins;
*cmp = 0;
}
return found;
return rnode;
}
static struct ring_node *ring_rb_entry(struct rb_node *node)