mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-05 15:47:02 +00:00
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:
+3
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user