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

Reply via email to