Re: [PATCH v2] blk: fix a wrong accounting of hd_struct->in_flight

From: Jens Axboe
Date: Thu Oct 14 2010 - 08:55:33 EST


On 2010-10-14 14:48, Yasuaki Ishimatsu wrote:
> Index: linux-2.6.36-rc7/block/blk-core.c
> ===================================================================
> --- linux-2.6.36-rc7.orig/block/blk-core.c 2010-10-07 05:39:52.000000000 +0900
> +++ linux-2.6.36-rc7/block/blk-core.c 2010-10-14 17:25:43.000000000 +0900
> @@ -66,9 +66,15 @@ static void drive_stat_acct(struct reque
> cpu = part_stat_lock();
> part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
>
> - if (!new_io)
> + if (!new_io) {
> + if (unlikely(rq->part != part)) {
> + part_dec_in_flight(rq->part, rw);
> + part_inc_in_flight(part, rw);
> + rq->part = part;
> + }
> part_stat_inc(cpu, part, merges[rw]);
> - else {
> + } else {
> + rq->part = part;
> part_round_stats(cpu, part);
> part_inc_in_flight(part, rw);
> }

I was thinking that we'd do away with the lookup always if ->part was
already set. It will probably require a quiscing of IO on partition
table reload, though.

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