Skip to content

Commit ceb08ee

Browse files
RichardWeiYangakpm00
authored andcommitted
lib/interval_tree: fix the comment of interval_tree_span_iter_next_gap()
The comment of interval_tree_span_iter_next_gap() is not exact, nodes[1] is not always !NULL. There are threes cases here. If there is an interior hole, the statement is correct. If there is a tailing hole or the contiguous used range span to the end, nodes[1] is NULL. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Wei Yang <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Michel Lespinasse <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1981128 commit ceb08ee

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/interval_tree.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ EXPORT_SYMBOL_GPL(interval_tree_iter_next);
2020
/*
2121
* Roll nodes[1] into nodes[0] by advancing nodes[1] to the end of a contiguous
2222
* span of nodes. This makes nodes[0]->last the end of that contiguous used span
23-
* indexes that started at the original nodes[1]->start. nodes[1] is now the
24-
* first node starting the next used span. A hole span is between nodes[0]->last
25-
* and nodes[1]->start. nodes[1] must be !NULL.
23+
* of indexes that started at the original nodes[1]->start.
24+
*
25+
* If there is an interior hole, nodes[1] is now the first node starting the
26+
* next used span. A hole span is between nodes[0]->last and nodes[1]->start.
27+
*
28+
* If there is a tailing hole, nodes[1] is now NULL. A hole span is between
29+
* nodes[0]->last and last_index.
30+
*
31+
* If the contiguous used range span to last_index, nodes[1] is set to NULL.
2632
*/
2733
static void
2834
interval_tree_span_iter_next_gap(struct interval_tree_span_iter *state)

0 commit comments

Comments
 (0)