qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v10 2/3] block: add I/O throttling algorithm


From: Zhi Yong Wu
Subject: Re: [Qemu-devel] [PATCH v10 2/3] block: add I/O throttling algorithm
Date: Tue, 1 Nov 2011 19:40:32 +0800

On Tue, Nov 1, 2011 at 7:33 PM, Stefan Hajnoczi <address@hidden> wrote:
> On Tue, Nov 1, 2011 at 7:40 AM, Zhi Yong Wu <address@hidden> wrote:
>> +static void bdrv_io_limits_intercept(BlockDriverState *bs,
>> +                                     int nb_sectors)
>> +{
>> +    int64_t wait_time = -1;
>> +
>> +    if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
>> +        qemu_co_queue_wait(&bs->throttled_reqs);
>> +        goto resume;
>> +    } else if (bdrv_exceed_io_limits(bs, nb_sectors, false, &wait_time)) {
>> +        if (wait_time != -1) {
>> +            qemu_mod_timer(bs->block_timer,
>> +                           wait_time + qemu_get_clock_ns(vm_clock));
>> +        }
>> +
>> +        qemu_co_queue_wait(&bs->throttled_reqs);
>> +
>> +resume:
>> +        while (bdrv_exceed_io_limits(bs, nb_sectors, false, &wait_time)) {
>
> is_write needs to be passed in to bdrv_exceed_io_limits().  Currently
> this accounts every I/O as a read.
Sorry, It is one stupid error.

>
>> +            qemu_mod_timer(bs->block_timer,
>> +                           wait_time + qemu_get_clock_ns(vm_clock));
>
> Do you need if (wait_time != -1) here?
Actually i think that we can drop the condition in our code.

>
> Stefan
>



-- 
Regards,

Zhi Yong Wu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]