Hello,

On Thu, Jul 16, 2015 at 11:16:47AM +0800, Ming Lei wrote:
...
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -651,9 +651,9 @@ static void start_io_acct(struct dm_io *io)
>  
>       cpu = part_stat_lock();
>       part_round_stats(cpu, &dm_disk(md)->part0);
> +     part_stat_set(cpu, &dm_disk(md)->part0, in_flight[rw],
> +                     atomic_inc_return(&md->pending[rw]));
>       part_stat_unlock();
> -     atomic_set(&dm_disk(md)->part0.in_flight[rw],
> -             atomic_inc_return(&md->pending[rw]));

Why is this correct?  Isn't the code trying to transfer its stat to
block stat verbatim?  Why does part_stat_set() have @cpu param at all?
Shouldn't it clear the whole thing and set one of the cpu counters to
the target value?

> @@ -679,7 +679,9 @@ static void end_io_acct(struct dm_io *io)
>        * a flush.
>        */
>       pending = atomic_dec_return(&md->pending[rw]);
> -     atomic_set(&dm_disk(md)->part0.in_flight[rw], pending);
> +     cpu = part_stat_lock();
> +     part_stat_set(cpu, &dm_disk(md)->part0, in_flight[rw], pending);
> +     part_stat_unlock();

Ditto.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to