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

Jens Axboe
2010-10-14T12:55:29Z

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