mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
block: Simplify block_set_io_throttle
Now that we can support boxed commands, use it to greatly reduce the number of parameters (and likelihood of getting out of sync) when adjusting throttle parameters. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <1468468228-27827-11-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
c818408e44
commit
4dc9397b62
3 changed files with 66 additions and 110 deletions
45
hmp.c
45
hmp.c
|
@ -1439,42 +1439,17 @@ void hmp_change(Monitor *mon, const QDict *qdict)
|
|||
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *err = NULL;
|
||||
BlockIOThrottle throttle = {
|
||||
.device = (char *) qdict_get_str(qdict, "device"),
|
||||
.bps = qdict_get_int(qdict, "bps"),
|
||||
.bps_rd = qdict_get_int(qdict, "bps_rd"),
|
||||
.bps_wr = qdict_get_int(qdict, "bps_wr"),
|
||||
.iops = qdict_get_int(qdict, "iops"),
|
||||
.iops_rd = qdict_get_int(qdict, "iops_rd"),
|
||||
.iops_wr = qdict_get_int(qdict, "iops_wr"),
|
||||
};
|
||||
|
||||
qmp_block_set_io_throttle(qdict_get_str(qdict, "device"),
|
||||
qdict_get_int(qdict, "bps"),
|
||||
qdict_get_int(qdict, "bps_rd"),
|
||||
qdict_get_int(qdict, "bps_wr"),
|
||||
qdict_get_int(qdict, "iops"),
|
||||
qdict_get_int(qdict, "iops_rd"),
|
||||
qdict_get_int(qdict, "iops_wr"),
|
||||
false, /* no burst max via HMP */
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false, /* no burst length via HMP */
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false, /* No default I/O size */
|
||||
0,
|
||||
false,
|
||||
NULL, &err);
|
||||
qmp_block_set_io_throttle(&throttle, &err);
|
||||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue