[Top][All Lists]
[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: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v10 2/3] block: add I/O throttling algorithm |
Date: |
Tue, 1 Nov 2011 11:33:36 +0000 |
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.
> + qemu_mod_timer(bs->block_timer,
> + wait_time + qemu_get_clock_ns(vm_clock));
Do you need if (wait_time != -1) here?
Stefan