From 3db3a445308b3cee9bbbd8baa6d05081c9532da0 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 21 Apr 2006 13:15:17 +0100 Subject: [RBTREE] Change rbtree off-tree marking in I/O schedulers. They were abusing the rb_color field to mark nodes which weren't currently on the tree. Fix that to use the same method as eventpoll did -- setting the parent pointer to point back to itself. And use the appropriate accessor macros for setting and reading the parent. Signed-off-by: David Woodhouse --- block/deadline-iosched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'block/deadline-iosched.c') diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index 399fa1e60e1f..06962d8402a3 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c @@ -165,10 +165,9 @@ deadline_find_drq_hash(struct deadline_data *dd, sector_t offset) /* * rb tree support functions */ -#define RB_NONE (2) #define RB_EMPTY(root) ((root)->rb_node == NULL) -#define ON_RB(node) ((node)->rb_color != RB_NONE) -#define RB_CLEAR(node) ((node)->rb_color = RB_NONE) +#define ON_RB(node) (rb_parent(node) != node) +#define RB_CLEAR(node) (rb_set_parent(node, node)) #define rb_entry_drq(node) rb_entry((node), struct deadline_rq, rb_node) #define DRQ_RB_ROOT(dd, drq) (&(dd)->sort_list[rq_data_dir((drq)->request)]) #define rq_rb_key(rq) (rq)->sector -- cgit v1.2.2