aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-04-27 12:00:06 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-04-27 12:00:06 -0500
commita8b69b8e2431edfcb6c4cfb069787e9071d6235b (patch)
tree5f6467e5b76c456625ef7b15f44fb9ff81dff8d6 /block
parenta75bfc5fdda8b87ff969d68e020ffdf1008751b1 (diff)
parentb3c83a2265261594d0a24507a17ad2f5c83eea81 (diff)
downloadqemu-a8b69b8e2431edfcb6c4cfb069787e9071d6235b.zip
qemu-a8b69b8e2431edfcb6c4cfb069787e9071d6235b.tar.gz
qemu-a8b69b8e2431edfcb6c4cfb069787e9071d6235b.tar.bz2
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qapi: fix qmp_balloon() conversion qemu-iotests: add block-stream speed value test case block: add 'speed' optional parameter to block-stream block: change block-job-set-speed argument from 'value' to 'speed' block: use Error mechanism instead of -errno for block_job_set_speed() block: use Error mechanism instead of -errno for block_job_create()
Diffstat (limited to 'block')
-rw-r--r--block/stream.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/block/stream.c b/block/stream.c
index 0efe1ad..6724af2 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -263,15 +263,15 @@ retry:
block_job_complete(&s->common, ret);
}
-static int stream_set_speed(BlockJob *job, int64_t value)
+static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
{
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
- if (value < 0) {
- return -EINVAL;
+ if (speed < 0) {
+ error_set(errp, QERR_INVALID_PARAMETER, "speed");
+ return;
}
- ratelimit_set_speed(&s->limit, value / BDRV_SECTOR_SIZE);
- return 0;
+ ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE);
}
static BlockJobType stream_job_type = {
@@ -280,16 +280,17 @@ static BlockJobType stream_job_type = {
.set_speed = stream_set_speed,
};
-int stream_start(BlockDriverState *bs, BlockDriverState *base,
- const char *base_id, BlockDriverCompletionFunc *cb,
- void *opaque)
+void stream_start(BlockDriverState *bs, BlockDriverState *base,
+ const char *base_id, int64_t speed,
+ BlockDriverCompletionFunc *cb,
+ void *opaque, Error **errp)
{
StreamBlockJob *s;
Coroutine *co;
- s = block_job_create(&stream_job_type, bs, cb, opaque);
+ s = block_job_create(&stream_job_type, bs, speed, cb, opaque, errp);
if (!s) {
- return -EBUSY; /* bs must already be in use */
+ return;
}
s->base = base;
@@ -300,5 +301,4 @@ int stream_start(BlockDriverState *bs, BlockDriverState *base,
co = qemu_coroutine_create(stream_run);
trace_stream_start(bs, base, s, co, opaque);
qemu_coroutine_enter(co, s);
- return 0;
}