Commit 14c1f34c authored by Werner Almesberger's avatar Werner Almesberger Committed by Linus Torvalds

[PATCH] prio_tree: roll call to prio_tree_first into prio_tree_next

Allow prio_tree_next to be used as the only function for tree traversal,
similar to how vma_prio_tree_next works.

This patch isn't needed for the generalization, but since it affects the API,
it's better to include it first.
Signed-off-by: default avatarWerner Almesberger <werner@almesberger.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0f6c5fa1
......@@ -29,6 +29,7 @@ static inline void prio_tree_iter_init(struct prio_tree_iter *iter,
iter->root = root;
iter->r_index = r_index;
iter->h_index = h_index;
iter->cur = NULL;
}
#define INIT_PRIO_TREE_ROOT(ptr) \
......
......@@ -457,6 +457,9 @@ static struct prio_tree_node *prio_tree_next(struct prio_tree_iter *iter)
{
unsigned long r_index, h_index;
if (iter->cur == NULL)
return prio_tree_first(iter);
repeat:
while (prio_tree_left(iter, &r_index, &h_index))
if (overlap(iter, r_index, h_index))
......@@ -620,7 +623,7 @@ struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma,
/*
* First call is with NULL vma
*/
ptr = prio_tree_first(iter);
ptr = prio_tree_next(iter);
if (ptr) {
next = prio_tree_entry(ptr, struct vm_area_struct,
shared.prio_tree_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment