[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/53] blockjob: add set_speed to BlockJobDriver
From: |
Max Reitz |
Subject: |
[PULL 33/53] blockjob: add set_speed to BlockJobDriver |
Date: |
Tue, 26 Jan 2021 15:19:56 +0100 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
We are going to use async block-copy call in backup, so we'll need to
passthrough setting backup speed to block-copy call.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210116214705.822267-9-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
include/block/blockjob_int.h | 2 ++
blockjob.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
index e2824a36a8..6633d83da2 100644
--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -52,6 +52,8 @@ struct BlockJobDriver {
* besides job->blk to the new AioContext.
*/
void (*attached_aio_context)(BlockJob *job, AioContext *new_context);
+
+ void (*set_speed)(BlockJob *job, int64_t speed);
};
/**
diff --git a/blockjob.c b/blockjob.c
index 98ac8af982..db3a21699c 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -256,6 +256,7 @@ static bool job_timer_pending(Job *job)
void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
{
+ const BlockJobDriver *drv = block_job_driver(job);
int64_t old_speed = job->speed;
if (job_apply_verb(&job->job, JOB_VERB_SET_SPEED, errp)) {
@@ -270,6 +271,11 @@ void block_job_set_speed(BlockJob *job, int64_t speed,
Error **errp)
ratelimit_set_speed(&job->limit, speed, BLOCK_JOB_SLICE_TIME);
job->speed = speed;
+
+ if (drv->set_speed) {
+ drv->set_speed(job, speed);
+ }
+
if (speed && speed <= old_speed) {
return;
}
--
2.29.2
- [PULL 25/53] coroutine-sigaltstack: Add SIGUSR2 mutex, (continued)
- [PULL 25/53] coroutine-sigaltstack: Add SIGUSR2 mutex, Max Reitz, 2021/01/26
- [PULL 27/53] block/block-copy: More explicit call_state, Max Reitz, 2021/01/26
- [PULL 23/53] iotests/129: Clean up pylint and mypy complaints, Max Reitz, 2021/01/26
- [PULL 26/53] qapi: backup: add perf.use-copy-range parameter, Max Reitz, 2021/01/26
- [PULL 21/53] iotests/129: Actually test a commit job, Max Reitz, 2021/01/26
- [PULL 24/53] iotests/300: Clean up pylint and mypy complaints, Max Reitz, 2021/01/26
- [PULL 28/53] block/block-copy: implement block_copy_async, Max Reitz, 2021/01/26
- [PULL 30/53] block/block-copy: add list of all call-states, Max Reitz, 2021/01/26
- [PULL 29/53] block/block-copy: add max_chunk and max_workers parameters, Max Reitz, 2021/01/26
- [PULL 31/53] block/block-copy: add ratelimit to block-copy, Max Reitz, 2021/01/26
- [PULL 33/53] blockjob: add set_speed to BlockJobDriver,
Max Reitz <=
- [PULL 34/53] job: call job_enter from job_pause, Max Reitz, 2021/01/26
- [PULL 35/53] qapi: backup: add max-chunk and max-workers to x-perf struct, Max Reitz, 2021/01/26
- [PULL 32/53] block/block-copy: add block_copy_cancel, Max Reitz, 2021/01/26
- [PULL 36/53] iotests: 56: prepare for backup over block-copy, Max Reitz, 2021/01/26
- [PULL 37/53] iotests/129: Limit backup's max-chunk/max-workers, Max Reitz, 2021/01/26
- [PULL 38/53] iotests: 185: prepare for backup over block-copy, Max Reitz, 2021/01/26
- [PULL 39/53] iotests: 219: prepare for backup over block-copy, Max Reitz, 2021/01/26
- [PULL 40/53] iotests: 257: prepare for backup over block-copy, Max Reitz, 2021/01/26
- [PULL 41/53] block/block-copy: make progress_bytes_callback optional, Max Reitz, 2021/01/26
- [PULL 42/53] block/backup: drop extra gotos from backup_run(), Max Reitz, 2021/01/26