Re: [RFC] Generalized prio_tree, revisited

From: Rajesh Venkatasubramanian
Date: Thu Dec 16 2004 - 15:12:11 EST


Werner Almesberger wrote:
You mean to roll prio_tree_first and prio_tree_iter_init into a
single call, so that prio_tree_first would look similar to the
one in 2.6.7 ?

Something like this...

---

linux-2.6.9-testuser/include/linux/prio_tree.h | 1 +
linux-2.6.9-testuser/mm/prio_tree.c | 3 +++
2 files changed, 4 insertions(+)

diff -puN include/linux/prio_tree.h~roll_prio_tree_first include/linux/prio_tree.h
--- linux-2.6.9/include/linux/prio_tree.h~roll_prio_tree_first 2004-12-16 14:52:46.878268680 -0500
+++ linux-2.6.9-testuser/include/linux/prio_tree.h 2004-12-16 14:55:18.731183528 -0500
@@ -29,6 +29,7 @@ static inline void prio_tree_iter_init(s
iter->root = root;
iter->r_index = r_index;
iter->h_index = h_index;
+ iter->cur = NULL;
}
#define INIT_PRIO_TREE_ROOT(ptr) \
diff -puN mm/prio_tree.c~roll_prio_tree_first mm/prio_tree.c
--- linux-2.6.9/mm/prio_tree.c~roll_prio_tree_first 2004-12-16 14:55:27.695820696 -0500
+++ linux-2.6.9-testuser/mm/prio_tree.c 2004-12-16 14:56:31.889061840 -0500
@@ -457,6 +457,9 @@ static struct prio_tree_node *prio_tree_
{
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))
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/