aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-01-18 20:20:24 +0100
committerKevin Wolf <kwolf@redhat.com>2018-05-15 16:11:50 +0200
commitf05fee508f538ca262d2ab19bcd8772196efe848 (patch)
tree03c8ecc8f7783131226f927d62dcff6a060b6a20 /block/commit.c
parent05df8a6a2b4e36e8d69de2130e616d5ac28e8837 (diff)
downloadqemu-f05fee508f538ca262d2ab19bcd8772196efe848.zip
qemu-f05fee508f538ca262d2ab19bcd8772196efe848.tar.gz
qemu-f05fee508f538ca262d2ab19bcd8772196efe848.tar.bz2
blockjob: Move RateLimit to BlockJob
Every block job has a RateLimit, and they all do the exact same thing with it, so it should be common infrastructure. Move the struct field for a start. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/commit.c b/block/commit.c
index 50b191c..beec5d0 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -35,7 +35,6 @@ enum {
typedef struct CommitBlockJob {
BlockJob common;
- RateLimit limit;
BlockDriverState *commit_top_bs;
BlockBackend *top;
BlockBackend *base;
@@ -201,7 +200,7 @@ static void coroutine_fn commit_run(void *opaque)
block_job_progress_update(&s->common, n);
if (copy && s->common.speed) {
- delay_ns = ratelimit_calculate_delay(&s->limit, n);
+ delay_ns = ratelimit_calculate_delay(&s->common.limit, n);
} else {
delay_ns = 0;
}
@@ -225,7 +224,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
return;
}
- ratelimit_set_speed(&s->limit, speed, SLICE_TIME);
+ ratelimit_set_speed(&s->common.limit, speed, SLICE_TIME);
}
static const BlockJobDriver commit_job_driver = {