Re: [PATCH] blkio: Fix a crash during rq stats update

From: Jens Axboe
Date: Wed Apr 21 2010 - 10:55:23 EST


On Wed, Apr 21 2010, Vivek Goyal wrote:
> @@ -1001,6 +1002,10 @@ static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create)
> return cfqg;
> }
>
> +static inline void cfq_get_cfqg_ref(struct cfq_group *cfqg) {
> + atomic_inc(&cfqg->ref);
> +}

Would be nicer as

static inline void cfq_ref_get_cfqg(struct cfq_group *cfqg)
{
atomic_inc(&cfqg->ref);
return cfqg;
}

...

static inline void cfq_ref_get_cfqg(struct cfq_group *cfqg)
{
return NULL;
}

...

> @@ -3560,6 +3570,9 @@ new_queue:
>
> rq->elevator_private = cic;
> rq->elevator_private2 = cfqq;
> + rq->elevator_private3 = cfqq->cfqg;
> + /* rq reference on cfqg */
> + cfq_get_cfqg_ref(RQ_CFQG(rq));
> return 0;

rq->elevator_private3 = cfq_ref_get_cfqg(...);

--
Jens Axboe

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