[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/13] throttle: Set always an average value when se
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH 05/13] throttle: Set always an average value when setting a maximum value |
Date: |
Fri, 5 Feb 2016 12:59:15 +0200 |
When testing the ranges of valid values, set_cfg_value() creates
sometimes invalid throttling configurations by setting bucket.max
while leaving bucket.avg uninitialized.
While this doesn't break the current tests, it will as soon as
we unify all functions that check the validity of the throttling
configuration.
This patch ensures that the value of bucket.avg is valid when setting
bucket.max.
Signed-off-by: Alberto Garcia <address@hidden>
---
tests/test-throttle.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 5f0b7d4..5031eb7 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -221,6 +221,8 @@ static void set_cfg_value(bool is_max, int index, int value)
{
if (is_max) {
cfg.buckets[index].max = value;
+ /* If max is set, avg should never be 0 */
+ cfg.buckets[index].avg = MAX(cfg.buckets[index].avg, 1);
} else {
cfg.buckets[index].avg = value;
}
--
2.7.0
- [Qemu-devel] [PATCH 00/13] throttle: Allow I/O bursts for a user-defined period of time, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 05/13] throttle: Set always an average value when setting a maximum value,
Alberto Garcia <=
- [Qemu-devel] [PATCH 09/13] throttle: Add command-line settings to define the burst periods, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 06/13] throttle: Merge all functions that check the configuration into one, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 01/13] throttle: Make throttle_compute_timer() static, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 04/13] throttle: Make throttle_is_valid() set errp, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 02/13] throttle: Make throttle_conflicting() set errp, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 12/13] throttle: Check that burst_level leaks correctly, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 07/13] throttle: Use throttle_config_init() to initialize ThrottleConfig, Alberto Garcia, 2016/02/05
- [Qemu-devel] [PATCH 08/13] throttle: Add support for burst periods, Alberto Garcia, 2016/02/05