diff options
author | Alberto Garcia <berto@igalia.com> | 2016-02-18 12:27:00 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-02-22 14:08:05 +0100 |
commit | 1588ab5d0b96301b893d63aa342faad0e37a02ff (patch) | |
tree | ea9e26c76a57df7e47dcd76d326f85c799f48d52 /blockdev.c | |
parent | d5851089a8a77d5c23e8d5fffb5b99265009ba62 (diff) | |
download | qemu-1588ab5d0b96301b893d63aa342faad0e37a02ff.tar.gz qemu-1588ab5d0b96301b893d63aa342faad0e37a02ff.tar.bz2 qemu-1588ab5d0b96301b893d63aa342faad0e37a02ff.zip |
throttle: Use throttle_config_init() to initialize ThrottleConfig
We can currently initialize ThrottleConfig by zeroing all its fields,
but this will change with the new fields to define the length of the
burst periods.
This patch introduces a new throttle_config_init() function and uses it
to replace all memset() calls that initialize ThrottleConfig directly.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c index 73babeb14e..e01486e896 100644 --- a/blockdev.c +++ b/blockdev.c @@ -387,7 +387,7 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags, } if (throttle_cfg) { - memset(throttle_cfg, 0, sizeof(*throttle_cfg)); + throttle_config_init(throttle_cfg); throttle_cfg->buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); throttle_cfg->buckets[THROTTLE_BPS_READ].avg = @@ -2611,7 +2611,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, goto out; } - memset(&cfg, 0, sizeof(cfg)); + throttle_config_init(&cfg); cfg.buckets[THROTTLE_BPS_TOTAL].avg = bps; cfg.buckets[THROTTLE_BPS_READ].avg = bps_rd; cfg.buckets[THROTTLE_BPS_WRITE].avg = bps_wr; |