diff options
author | John Snow <jsnow@redhat.com> | 2016-11-08 01:50:36 -0500 |
---|---|---|
committer | Jeff Cody <jcody@redhat.com> | 2016-11-14 22:47:34 -0500 |
commit | a7815a764c40c9dcf204f666c2d90248095376a8 (patch) | |
tree | 6218069fef5d588f66950b1fd11cbfa87b043aca /block/mirror.c | |
parent | e8a40bf71d606f9f87866fb2461eaed52814b38e (diff) |
blockjob: add .start field
Add an explicit start field to specify the entrypoint. We already have
ownership of the coroutine itself AND managing the lifetime of the
coroutine, let's take control of creation of the coroutine, too.
This will allow us to delay creation of the actual coroutine until we
know we'll actually start a BlockJob in block_job_start. This avoids
the sticky question of how to "un-create" a Coroutine that hasn't been
started yet.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1478587839-9834-4-git-send-email-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r-- | block/mirror.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/mirror.c b/block/mirror.c index b2c1fb855b..659e09cbaf 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -920,6 +920,7 @@ static const BlockJobDriver mirror_job_driver = { .instance_size = sizeof(MirrorBlockJob), .job_type = BLOCK_JOB_TYPE_MIRROR, .set_speed = mirror_set_speed, + .start = mirror_run, .complete = mirror_complete, .pause = mirror_pause, .attached_aio_context = mirror_attached_aio_context, @@ -930,6 +931,7 @@ static const BlockJobDriver commit_active_job_driver = { .instance_size = sizeof(MirrorBlockJob), .job_type = BLOCK_JOB_TYPE_COMMIT, .set_speed = mirror_set_speed, + .start = mirror_run, .complete = mirror_complete, .pause = mirror_pause, .attached_aio_context = mirror_attached_aio_context, @@ -1007,7 +1009,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, } } - s->common.co = qemu_coroutine_create(mirror_run, s); + s->common.co = qemu_coroutine_create(s->common.driver->start, s); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co); } |