aboutsummaryrefslogtreecommitdiff
path: root/block/stream.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-01-18 20:25:40 +0100
committerKevin Wolf <kwolf@redhat.com>2018-05-15 16:11:50 +0200
commit18bb69287ea522ab696e1bea818b93e5eaa85745 (patch)
tree881877ce730553c75abcf6bf5a2aa50870993874 /block/stream.c
parentf05fee508f538ca262d2ab19bcd8772196efe848 (diff)
downloadqemu-18bb69287ea522ab696e1bea818b93e5eaa85745.zip
qemu-18bb69287ea522ab696e1bea818b93e5eaa85745.tar.gz
qemu-18bb69287ea522ab696e1bea818b93e5eaa85745.tar.bz2
blockjob: Implement block_job_set_speed() centrally
All block job drivers support .set_speed and all of them duplicate the same code to implement it. Move that code to blockjob.c and remove the now useless callback. 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/stream.c')
-rw-r--r--block/stream.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/block/stream.c b/block/stream.c
index a1d4768..797d7c4f 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -29,8 +29,6 @@ enum {
STREAM_BUFFER_SIZE = 512 * 1024, /* in bytes */
};
-#define SLICE_TIME 100000000ULL /* ns */
-
typedef struct StreamBlockJob {
BlockJob common;
BlockDriverState *base;
@@ -210,21 +208,9 @@ out:
block_job_defer_to_main_loop(&s->common, stream_complete, data);
}
-static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
-{
- StreamBlockJob *s = container_of(job, StreamBlockJob, common);
-
- if (speed < 0) {
- error_setg(errp, QERR_INVALID_PARAMETER, "speed");
- return;
- }
- ratelimit_set_speed(&s->common.limit, speed, SLICE_TIME);
-}
-
static const BlockJobDriver stream_job_driver = {
.instance_size = sizeof(StreamBlockJob),
.job_type = BLOCK_JOB_TYPE_STREAM,
- .set_speed = stream_set_speed,
.start = stream_run,
};