[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 08/23] blockjob: add set_speed to BlockJobDriver
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v4 08/23] blockjob: add set_speed to BlockJobDriver |
Date: |
Sun, 17 Jan 2021 00:46:50 +0300 |
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>
---
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
- [PATCH v4 02/23] block/block-copy: More explicit call_state, (continued)
- [PATCH v4 02/23] block/block-copy: More explicit call_state, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 03/23] block/block-copy: implement block_copy_async, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 06/23] block/block-copy: add ratelimit to block-copy, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 05/23] block/block-copy: add list of all call-states, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 09/23] job: call job_enter from job_pause, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 10/23] qapi: backup: add max-chunk and max-workers to x-perf struct, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 04/23] block/block-copy: add max_chunk and max_workers parameters, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 07/23] block/block-copy: add block_copy_cancel, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 11/23] iotests: 56: prepare for backup over block-copy, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 08/23] blockjob: add set_speed to BlockJobDriver,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v4 19/23] block/block-copy: drop unused block_copy_set_progress_callback(), Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 12/23] iotests: 185: prepare for backup over block-copy, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 13/23] iotests: 219: prepare for backup over block-copy, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 16/23] block/backup: drop extra gotos from backup_run(), Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 23/23] simplebench: add bench-backup.py, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 20/23] block/block-copy: drop unused argument of block_copy(), Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 15/23] block/block-copy: make progress_bytes_callback optional, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 21/23] simplebench/bench_block_job: use correct shebang line with python3, Vladimir Sementsov-Ogievskiy, 2021/01/16
- [PATCH v4 18/23] qapi: backup: disable copy_range by default, Vladimir Sementsov-Ogievskiy, 2021/01/16