On Tue, Nov 1, 2011 at 7:33 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Tue, Nov 1, 2011 at 7:40 AM, Zhi Yong Wu <wu...@linux.vnet.ibm.com> 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