[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 05/17] throttle: Set always an average value when
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH v2 05/17] throttle: Set always an average value when setting a maximum value |
Date: |
Thu, 18 Feb 2016 12:26:58 +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>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <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 0e7c7e0..3e208a8 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -222,6 +222,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 v2 07/17] throttle: Use throttle_config_init() to initialize ThrottleConfig, (continued)
- [Qemu-devel] [PATCH v2 07/17] throttle: Use throttle_config_init() to initialize ThrottleConfig, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 04/17] throttle: Make throttle_is_valid() set errp, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 12/17] throttle: Check that burst_level leaks correctly, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 01/17] throttle: Make throttle_compute_timer() static, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 17/17] MAINTAINERS: Add myself as maintainer of the throttling code, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 14/17] qemu-iotests: Extend iotest 093 to test bursts, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 09/17] throttle: Add command-line settings to define the burst periods, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 13/17] throttle: Test throttle_compute_wait() during bursts, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 15/17] qapi: Correct the name of the iops_rd parameter, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 08/17] throttle: Add support for burst periods, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 05/17] throttle: Set always an average value when setting a maximum value,
Alberto Garcia <=
- [Qemu-devel] [PATCH v2 06/17] throttle: Merge all functions that check the configuration into one, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 10/17] qapi: Add burst length parameters to block_set_io_throttle, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 11/17] qapi: Add burst length fields to BlockDeviceInfo, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 16/17] docs: Document the throttling infrastructure, Alberto Garcia, 2016/02/18
- [Qemu-devel] [PATCH v2 03/17] throttle: Make throttle_max_is_missing_limit() set errp, Alberto Garcia, 2016/02/18
- Re: [Qemu-devel] [PATCH v2 00/17] throttle: Allow I/O bursts for a user-defined period of time, Kevin Wolf, 2016/02/22