void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,

                               int64_t bps_wr, int64_t iops, int64_t iops_rd,

                               int64_t iops_wr, Error **errp)

{

    BlockIOLimit io_limits;

    BlockDriverState *bs;



    bs = bdrv_find(device);

    if (!bs) {

        error_set(errp, QERR_DEVICE_NOT_FOUND, device);

        return;

    }



    io_limits.bps[BLOCK_IO_LIMIT_TOTAL] = bps;

    io_limits.bps[BLOCK_IO_LIMIT_READ]  = bps_rd;

    io_limits.bps[BLOCK_IO_LIMIT_WRITE] = bps_wr;

    io_limits.iops[BLOCK_IO_LIMIT_TOTAL]= iops;

    io_limits.iops[BLOCK_IO_LIMIT_READ] = iops_rd;

    io_limits.iops[BLOCK_IO_LIMIT_WRITE]= iops_wr;



    if (!do_check_io_limits(&io_limits)) {

        error_set(errp, QERR_INVALID_PARAMETER_COMBINATION);

        return;

    }



    bs->io_limits = io_limits;

    bs->slice_time = BLOCK_IO_SLICE_TIME;



    if (!bs->io_limits_enabled && bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_enable(bs);

    } else if (bs->io_limits_enabled && !bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_disable(bs);

    } else {

        if (bs->block_timer) {

            qemu_mod_timer(bs->block_timer, qemu_get_clock_ns(vm_clock));

        }

    }

}

void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,

                               int64_t bps_wr, int64_t iops, int64_t iops_rd,

                               int64_t iops_wr, Error **errp)

{

    BlockIOLimit io_limits;

    BlockDriverState *bs;



    bs = bdrv_find(device);

    if (!bs) {

        error_set(errp, QERR_DEVICE_NOT_FOUND, device);

        return;

    }



    io_limits.bps[BLOCK_IO_LIMIT_TOTAL] = bps;

    io_limits.bps[BLOCK_IO_LIMIT_READ]  = bps_rd;

    io_limits.bps[BLOCK_IO_LIMIT_WRITE] = bps_wr;

    io_limits.iops[BLOCK_IO_LIMIT_TOTAL]= iops;

    io_limits.iops[BLOCK_IO_LIMIT_READ] = iops_rd;

    io_limits.iops[BLOCK_IO_LIMIT_WRITE]= iops_wr;



    if (!do_check_io_limits(&io_limits)) {

        error_set(errp, QERR_INVALID_PARAMETER_COMBINATION);

        return;

    }



    bs->io_limits = io_limits;

    bs->slice_time = BLOCK_IO_SLICE_TIME;



    if (!bs->io_limits_enabled && bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_enable(bs);

    } else if (bs->io_limits_enabled && !bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_disable(bs);

    } else {

        if (bs->block_timer) {

            qemu_mod_timer(bs->block_timer, qemu_get_clock_ns(vm_clock));

        }

    }

}

void FUNC_0(const char *VAR_0, int64_t VAR_1, int64_t VAR_2,

                               int64_t VAR_3, int64_t VAR_4, int64_t VAR_5,

                               int64_t VAR_6, Error **VAR_7)

{

    BlockIOLimit io_limits;

    BlockDriverState *bs;



    bs = bdrv_find(VAR_0);

    if (!bs) {

        error_set(VAR_7, QERR_DEVICE_NOT_FOUND, VAR_0);

        return;

    }



    io_limits.VAR_1[BLOCK_IO_LIMIT_TOTAL] = VAR_1;

    io_limits.VAR_1[BLOCK_IO_LIMIT_READ]  = VAR_2;

    io_limits.VAR_1[BLOCK_IO_LIMIT_WRITE] = VAR_3;

    io_limits.VAR_4[BLOCK_IO_LIMIT_TOTAL]= VAR_4;

    io_limits.VAR_4[BLOCK_IO_LIMIT_READ] = VAR_5;

    io_limits.VAR_4[BLOCK_IO_LIMIT_WRITE]= VAR_6;



    if (!do_check_io_limits(&io_limits)) {

        error_set(VAR_7, QERR_INVALID_PARAMETER_COMBINATION);

        return;

    }



    bs->io_limits = io_limits;

    bs->slice_time = BLOCK_IO_SLICE_TIME;



    if (!bs->io_limits_enabled && bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_enable(bs);

    } else if (bs->io_limits_enabled && !bdrv_io_limits_enabled(bs)) {

        bdrv_io_limits_disable(bs);

    } else {

        if (bs->block_timer) {

            qemu_mod_timer(bs->block_timer, qemu_get_clock_ns(vm_clock));

        }

    }

}

void FUNC_0(const char *VAR_0, int64_t VAR_1, int64_t VAR_2,
int64_t VAR_3, int64_t VAR_4, int64_t VAR_5,
int64_t VAR_6, Error **VAR_7)
{ BlockIOLimit io_limits; BlockDriverState *bs; bs = bdrv_find(VAR_0); if (!bs) { error_set(VAR_7, QERR_DEVICE_NOT_FOUND, VAR_0); return; } io_limits.VAR_1[BLOCK_IO_LIMIT_TOTAL] = VAR_1; io_limits.VAR_1[BLOCK_IO_LIMIT_READ]  = VAR_2; io_limits.VAR_1[BLOCK_IO_LIMIT_WRITE] = VAR_3; io_limits.VAR_4[BLOCK_IO_LIMIT_TOTAL]= VAR_4; io_limits.VAR_4[BLOCK_IO_LIMIT_READ] = VAR_5; io_limits.VAR_4[BLOCK_IO_LIMIT_WRITE]= VAR_6; if (!do_check_io_limits(&io_limits)) { error_set(VAR_7, QERR_INVALID_PARAMETER_COMBINATION); return; } bs->io_limits = io_limits; bs->slice_time = BLOCK_IO_SLICE_TIME; if (!bs->io_limits_enabled && bdrv_io_limits_enabled(bs)) { bdrv_io_limits_enable(bs); } else if (bs->io_limits_enabled && !bdrv_io_limits_enabled(bs)) { bdrv_io_limits_disable(bs); } else { if (bs->block_timer) { qemu_mod_timer(bs->block_timer, qemu_get_clock_ns(vm_clock)); } } }