diff options
author | Eric Blake <eblake@redhat.com> | 2016-07-13 21:50:21 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-07-19 13:21:08 +0200 |
commit | 4dc9397b62c1a50a4afb5881abb55d07058e0812 (patch) | |
tree | 0131cba329d72bf415a99bb6fd522c09c6ac1ef0 /hmp.c | |
parent | c818408e449ea55371253bd4def1c1dc87b7bb03 (diff) |
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>
Diffstat (limited to 'hmp.c')
-rw-r--r-- | hmp.c | 45 |
1 files changed, 10 insertions, 35 deletions
@@ -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); } |