[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/16] block: move restarting of throttled reqs
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 02/16] block: move restarting of throttled reqs to block/throttle-groups.c |
Date: |
Wed, 9 Mar 2016 08:37:36 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 09/03/2016 02:26, Fam Zheng wrote:
>> diff --git a/block/throttle-groups.c b/block/throttle-groups.c
>> index 4920e09..eccfc0d 100644
>> --- a/block/throttle-groups.c
>> +++ b/block/throttle-groups.c
>> @@ -313,6 +313,17 @@ void coroutine_fn
>> throttle_group_co_io_limits_intercept(BlockDriverState *bs,
>> qemu_mutex_unlock(&tg->lock);
>> }
>>
>> +void throttle_group_restart_bs(BlockDriverState *bs)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < 2; i++) {
>> + while (qemu_co_enter_next(&bs->throttled_reqs[i])) {
>> + ;
>> + }
>> + }
>> +}
>> +
>> /* Update the throttle configuration for a particular group. Similar
>> * to throttle_config(), but guarantees atomicity within the
>> * throttling group.
>> @@ -335,6 +346,10 @@ void throttle_group_config(BlockDriverState *bs,
>> ThrottleConfig *cfg)
>> }
>> throttle_config(ts, tt, cfg);
>> qemu_mutex_unlock(&tg->lock);
>> +
>> + aio_context_acquire(bdrv_get_aio_context(bs));
>> + throttle_group_restart_bs(bs);
>> + aio_context_release(bdrv_get_aio_context(bs));
>
> Could you explain why does this hunk belong to this patch?
>
> Otherwise looks good.
Sure. It's moved from bdrv_set_io_limits, which calls
throttle_group_config, to throttle_group_config itself:
>> void bdrv_set_io_limits(BlockDriverState *bs,
>> ThrottleConfig *cfg)
>> {
>> - int i;
>> -
>> throttle_group_config(bs, cfg);
>> -
>> - for (i = 0; i < 2; i++) {
>> - qemu_co_enter_next(&bs->throttled_reqs[i]);
>> - }
>> }
>>
But in v2 I'll change it to only restart the first request so there is
no semantic change.
Paolo