On 04/17/2017 02:18 PM, John Snow wrote: > > > On 04/11/2017 06:29 PM, Eric Blake wrote: >> The user interface specifies job rate limits in bytes/second. >> It's pointless to have our internal representation track things >> in sectors/second, particularly since we want to move away from >> sector-based interfaces. >> >> Fix up a doc typo found while verifying that the ratelimit >> code handles the scaling difference. >> >> Signed-off-by: Eric Blake <[email protected]> >> ---
>> +++ b/block/commit.c
>> @@ -195,7 +195,8 @@ static void coroutine_fn commit_run(void *opaque)
>> s->common.offset += n * BDRV_SECTOR_SIZE;
>>
>> if (copy && s->common.speed) {
>> - delay_ns = ratelimit_calculate_delay(&s->limit, n);
>> + delay_ns = ratelimit_calculate_delay(&s->limit,
>> + n * BDRV_SECTOR_SIZE);
>
> You could probably factor out this calculation in conjunction with the
> offset update above, but no matter.
It gets simplified in a later patch, when I switch the entire function
to track by bytes instead of sectors.
>> +++ b/block/stream.c
>> @@ -191,7 +191,8 @@ static void coroutine_fn stream_run(void *opaque)
>> /* Publish progress */
>> s->common.offset += n * BDRV_SECTOR_SIZE;
>> if (copy && s->common.speed) {
>> - delay_ns = ratelimit_calculate_delay(&s->limit, n);
>> + delay_ns = ratelimit_calculate_delay(&s->limit,
>> + n * BDRV_SECTOR_SIZE);
>
> Same kind of comment here.
And same response :)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
