aboutsummaryrefslogtreecommitdiff
path: root/block/backup.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/backup.c
parent05df8a6a2b4e36e8d69de2130e616d5ac28e8837 (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/backup.c')
-rw-r--r--block/backup.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/backup.c b/block/backup.c
index 5d95805472..7585c4391e 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -35,7 +35,6 @@ typedef struct BackupBlockJob {
/* bitmap for sync=incremental */
BdrvDirtyBitmap *sync_bitmap;
MirrorSyncMode sync_mode;
- RateLimit limit;
BlockdevOnError on_source_error;
BlockdevOnError on_target_error;
CoRwlock flush_rwlock;
@@ -199,7 +198,7 @@ static void backup_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 backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
@@ -346,7 +345,7 @@ static bool coroutine_fn yield_and_check(BackupBlockJob *job)
* (without, VM does not reboot)
*/
if (job->common.speed) {
- uint64_t delay_ns = ratelimit_calculate_delay(&job->limit,
+ uint64_t delay_ns = ratelimit_calculate_delay(&job->common.limit,
job->bytes_read);
job->bytes_read = 0;
block_job_sleep_ns(&job->common, delay_ns);