mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
throttle: Make LeakyBucket.avg and LeakyBucket.max integer types
Both the throttling limits set with the throttling.iops-* and throttling.bps-* options and their QMP equivalents defined in the BlockIOThrottle struct are integer values. Those limits are also reported in the BlockDeviceInfo struct and they are integers there as well. Therefore there's no reason to store them internally as double and do the conversion everytime we're setting or querying them, so this patch uses uint64_t for those types. Let's also use an unsigned type because we don't allow negative values anyway. LeakyBucket.level and LeakyBucket.burst_level do however remain double because their value changes depending on the fraction of time elapsed since the previous I/O operation. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: f29b840422767b5be2c41c2dfdbbbf6c5f8fedf8.1503580370.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
2a8be39eba
commit
d00e6923b1
3 changed files with 7 additions and 7 deletions
|
@ -284,13 +284,14 @@ static void test_enabled(void)
|
|||
for (i = 0; i < BUCKETS_COUNT; i++) {
|
||||
throttle_config_init(&cfg);
|
||||
set_cfg_value(false, i, 150);
|
||||
g_assert(throttle_is_valid(&cfg, NULL));
|
||||
g_assert(throttle_enabled(&cfg));
|
||||
}
|
||||
|
||||
for (i = 0; i < BUCKETS_COUNT; i++) {
|
||||
throttle_config_init(&cfg);
|
||||
set_cfg_value(false, i, -150);
|
||||
g_assert(!throttle_enabled(&cfg));
|
||||
g_assert(!throttle_is_valid(&cfg, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue