diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-01-18 20:20:24 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-15 16:11:50 +0200 |
commit | f05fee508f538ca262d2ab19bcd8772196efe848 (patch) | |
tree | 03c8ecc8f7783131226f927d62dcff6a060b6a20 /block/mirror.c | |
parent | 05df8a6a2b4e36e8d69de2130e616d5ac28e8837 (diff) |
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/mirror.c')
-rw-r--r-- | block/mirror.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/mirror.c b/block/mirror.c index 56a7ce2f55..702c139368 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -36,7 +36,6 @@ typedef struct MirrorBuffer { typedef struct MirrorBlockJob { BlockJob common; - RateLimit limit; BlockBackend *target; BlockDriverState *mirror_top_bs; BlockDriverState *source; @@ -450,7 +449,8 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) offset += io_bytes; nb_chunks -= DIV_ROUND_UP(io_bytes, s->granularity); if (s->common.speed) { - delay_ns = ratelimit_calculate_delay(&s->limit, io_bytes_acct); + delay_ns = ratelimit_calculate_delay(&s->common.limit, + io_bytes_acct); } } return delay_ns; @@ -916,7 +916,7 @@ static void mirror_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 void mirror_complete(BlockJob *job, Error **errp) |