Skip to content

Commit

Permalink
cfq-iosched: clear ->prio_trees[] on cfqd alloc
Browse files Browse the repository at this point in the history
Not strictly needed, but we should make it clear that we init the
rbtree roots here.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Apr 24, 2009
1 parent 17d5c8c commit 26a2ac0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2446,12 +2446,22 @@ static void cfq_exit_queue(struct elevator_queue *e)
static void *cfq_init_queue(struct request_queue *q)
{
struct cfq_data *cfqd;
int i;

cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
if (!cfqd)
return NULL;

cfqd->service_tree = CFQ_RB_ROOT;

/*
* Not strictly needed (since RB_ROOT just clears the node and we
* zeroed cfqd on alloc), but better be safe in case someone decides
* to add magic to the rb code
*/
for (i = 0; i < CFQ_PRIO_LISTS; i++)
cfqd->prio_trees[i] = RB_ROOT;

INIT_LIST_HEAD(&cfqd->cic_list);

cfqd->queue = q;
Expand Down

0 comments on commit 26a2ac0

Please sign in to comment.