static void bdrv_io_limits_intercept(BlockDriverState *bs,

                                     int nb_sectors,

                                     bool is_write)

{

    /* does this io must wait */

    bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write);



    /* if must wait or any request of this type throttled queue the IO */

    if (must_wait ||

        !qemu_co_queue_empty(&bs->throttled_reqs[is_write])) {

        qemu_co_queue_wait(&bs->throttled_reqs[is_write]);

    }



    /* the IO will be executed, do the accounting */

    throttle_account(&bs->throttle_state,

                     is_write,

                     nb_sectors * BDRV_SECTOR_SIZE);



    /* if the next request must wait -> do nothing */

    if (throttle_schedule_timer(&bs->throttle_state, is_write)) {

        return;

    }



    /* else queue next request for execution */

    qemu_co_queue_next(&bs->throttled_reqs[is_write]);

}

static void bdrv_io_limits_intercept(BlockDriverState *bs,

                                     int nb_sectors,

                                     bool is_write)

{

    

    bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write);



    

    if (must_wait ||

        !qemu_co_queue_empty(&bs->throttled_reqs[is_write])) {

        qemu_co_queue_wait(&bs->throttled_reqs[is_write]);

    }



    

    throttle_account(&bs->throttle_state,

                     is_write,

                     nb_sectors * BDRV_SECTOR_SIZE);



    

    if (throttle_schedule_timer(&bs->throttle_state, is_write)) {

        return;

    }



    

    qemu_co_queue_next(&bs->throttled_reqs[is_write]);

}

static void FUNC_0(BlockDriverState *VAR_0,

                                     int VAR_1,

                                     bool VAR_2)

{

    

    bool must_wait = throttle_schedule_timer(&VAR_0->throttle_state, VAR_2);



    

    if (must_wait ||

        !qemu_co_queue_empty(&VAR_0->throttled_reqs[VAR_2])) {

        qemu_co_queue_wait(&VAR_0->throttled_reqs[VAR_2]);

    }



    

    throttle_account(&VAR_0->throttle_state,

                     VAR_2,

                     VAR_1 * BDRV_SECTOR_SIZE);



    

    if (throttle_schedule_timer(&VAR_0->throttle_state, VAR_2)) {

        return;

    }



    

    qemu_co_queue_next(&VAR_0->throttled_reqs[VAR_2]);

}

static void FUNC_0(BlockDriverState *VAR_0,
int VAR_1,
bool VAR_2)
{ bool must_wait = throttle_schedule_timer(&VAR_0->throttle_state, VAR_2); if (must_wait ||
!qemu_co_queue_empty(&VAR_0->throttled_reqs[VAR_2])) { qemu_co_queue_wait(&VAR_0->throttled_reqs[VAR_2]); } throttle_account(&VAR_0->throttle_state,
VAR_2,
VAR_1 * BDRV_SECTOR_SIZE); if (throttle_schedule_timer(&VAR_0->throttle_state, VAR_2)) { return; } qemu_co_queue_next(&VAR_0->throttled_reqs[VAR_2]); }