scoutfs: fix next ival busy loop

The next interval interface didn't set the ival to return to null when
it finds a null next node.  The caller would continuously get the same
interval.

This is what I get for programming late at night, I guess.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-04-02 17:17:19 -07:00
parent eb790a7761
commit 20cc8c220c
+6 -7
View File
@@ -135,14 +135,13 @@ struct scoutfs_ival *scoutfs_next_ival(struct scoutfs_ival_tree *tree,
if (!ival)
return first_ival(tree, start, end);
while ((node = rb_next(&ival->node))) {
node = rb_next(&ival->node);
if (node) {
ival = container_of(node, struct scoutfs_ival, node);
if (scoutfs_cmp_key_ranges(start, end,
&ival->start, &ival->end))
ival = NULL;
break;
if (!scoutfs_cmp_key_ranges(start, end,
&ival->start, &ival->end))
return ival;
}
return ival;
return NULL;
}