[RFC] [PATCH 6/8] cfq-iosched: Get rid of on_st flag

From: Gui Jianfeng
Date: Sun Nov 14 2010 - 19:57:42 EST


It's able to check whether a CFQ group on a service tree by
checking "entity->rb_node". There's no need to maintain an
extra flag here.


Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
---
block/cfq-iosched.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 1b9b4b2..1df0928 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -103,7 +103,6 @@ struct io_sched_entity {
struct rb_node rb_node;
/* service_tree key */
u64 vdisktime;
- bool on_st;
bool is_group_entity;
unsigned int weight;
};
@@ -890,8 +889,6 @@ io_entity_service_tree_add(struct cfq_rb_root *st,
__io_entity_service_tree_add(st, io_entity);
st->count++;
st->total_weight += io_entity->weight;
- if (io_entity->is_group_entity)
- io_entity->on_st = true;
}

static void
@@ -903,7 +900,7 @@ cfq_group_service_tree_add(struct cfq_data *cfqd, struct cfq_group *cfqg)
struct io_sched_entity *__group_entity;

cfqg->nr_cfqq++;
- if (group_entity->on_st)
+ if (!RB_EMPTY_NODE(&group_entity->rb_node))
return;

/*
@@ -936,8 +933,6 @@ io_entity_service_tree_del(struct cfq_rb_root *st,
if (!RB_EMPTY_NODE(&io_entity->rb_node)) {
__io_entity_service_tree_del(st, io_entity);
st->total_weight -= io_entity->weight;
- if (io_entity->is_group_entity)
- io_entity->on_st = false;
io_entity->service_tree = NULL;
}
}
@@ -1070,7 +1065,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
RB_CLEAR_NODE(&cfqg->group_entity.rb_node);

cfqg->group_entity.is_group_entity = true;
- cfqg->group_entity.on_st = false;

/*
* Take the initial reference that will be released on destroy
@@ -3972,7 +3966,6 @@ static void *cfq_init_queue(struct request_queue *q)
/* Give preference to root group over other groups */
cfqg->group_entity.weight = 2*BLKIO_WEIGHT_DEFAULT;
cfqg->group_entity.is_group_entity = true;
- cfqg->group_entity.on_st = false;

#ifdef CONFIG_CFQ_GROUP_IOSCHED
/*
--
1.6.5.2

--
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/