diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-04-21 14:02:10 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-04-21 14:02:10 +0100 |
commit | 09fc586db3b0917c3f5ad0c56e60920c5061422b (patch) | |
tree | 463466161a66dba4d017fe0a6eb4f36fcc2738ad /util | |
parent | b4c963fa82ff5c0d7a991acb7e72e33f12eed1d4 (diff) | |
parent | 3ccc0a0163b932fe980dce8d26db4bf98b1900e9 (diff) |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Fri 21 Apr 2017 10:43:04 BST
# gpg: using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
MAINTAINERS: update my email address
MAINTAINERS: update Wen's email address
migration/block: use blk_pwrite_zeroes for each zero cluster
throttle: make throttle_config(throttle_get_config()) symmetric
throttle: do not use invalid config in test
qemu-options: explain disk I/O throttling options
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/throttle.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/util/throttle.c b/util/throttle.c index 3817d9b904..3570ed25fc 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -380,6 +380,14 @@ static void throttle_fix_bucket(LeakyBucket *bkt) } } +/* undo internal bucket parameter changes (see throttle_fix_bucket()) */ +static void throttle_unfix_bucket(LeakyBucket *bkt) +{ + if (bkt->max < bkt->avg) { + bkt->max = 0; + } +} + /* take care of canceling a timer */ static void throttle_cancel_timer(QEMUTimer *timer) { @@ -420,7 +428,13 @@ void throttle_config(ThrottleState *ts, */ void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) { + int i; + *cfg = ts->cfg; + + for (i = 0; i < BUCKETS_COUNT; i++) { + throttle_unfix_bucket(&cfg->buckets[i]); + } } |