[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 19/24] blockjob: add set_speed to BlockJobDriver
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[RFC 19/24] blockjob: add set_speed to BlockJobDriver |
Date: |
Fri, 15 Nov 2019 17:14:39 +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 <address@hidden>
---
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 c6e20e2fcd..3b827d420d 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -255,6 +255,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)) {
@@ -268,6 +269,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.21.0
- [RFC 00/24] backup performance: block_status + async, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 20/24] job: call job_enter from job_user_pause, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 19/24] blockjob: add set_speed to BlockJobDriver,
Vladimir Sementsov-Ogievskiy <=
- [RFC 16/24] block/block-copy: add max_chunk and max_workers paramters, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 03/24] block/block-copy: factor out block_copy_find_inflight_req, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 12/24] block/block-copy: move block_copy_task_create down, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 09/24] block/block-copy: alloc task on each iteration, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 18/24] block/block-copy: add block_copy_cancel, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 23/24] python: add qemu/bench_block_job.py, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 17/24] block/block-copy: add ratelimit to block-copy, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 15/24] block/block-copy: implement block_copy_async, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 14/24] block/block-copy: More explicit call_state, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 08/24] block/block-copy: rename in-flight requests to tasks, Vladimir Sementsov-Ogievskiy, 2019/11/15