diff options
author | John Snow <jsnow@redhat.com> | 2016-11-08 01:50:37 -0500 |
---|---|---|
committer | Jeff Cody <jcody@redhat.com> | 2016-11-14 22:47:34 -0500 |
commit | 5ccac6f186e4a480074880d958760c7105cf9ba8 (patch) | |
tree | 7f5f66df425b35ad18683743788ad575032cbeea /tests | |
parent | a7815a764c40c9dcf204f666c2d90248095376a8 (diff) | |
download | qemu-5ccac6f186e4a480074880d958760c7105cf9ba8.zip qemu-5ccac6f186e4a480074880d958760c7105cf9ba8.tar.gz qemu-5ccac6f186e4a480074880d958760c7105cf9ba8.tar.bz2 |
blockjob: add block_job_start
Instead of automatically starting jobs at creation time via backup_start
et al, we'd like to return a job object pointer that can be started
manually at later point in time.
For now, add the block_job_start mechanism and start the jobs
automatically as we have been doing, with conversions job-by-job coming
in later patches.
Of note: cancellation of unstarted jobs will perform all the normal
cleanup as if the job had started, particularly abort and clean. The
only difference is that we will not emit any events, because the job
never actually started.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1478587839-9834-5-git-send-email-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-blockjob-txn.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index f9afc3b..b132e39 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -24,10 +24,6 @@ typedef struct { int *result; } TestBlockJob; -static const BlockJobDriver test_block_job_driver = { - .instance_size = sizeof(TestBlockJob), -}; - static void test_block_job_complete(BlockJob *job, void *opaque) { BlockDriverState *bs = blk_bs(job->blk); @@ -77,6 +73,11 @@ static void test_block_job_cb(void *opaque, int ret) g_free(data); } +static const BlockJobDriver test_block_job_driver = { + .instance_size = sizeof(TestBlockJob), + .start = test_block_job_run, +}; + /* Create a block job that completes with a given return code after a given * number of event loop iterations. The return code is stored in the given * result pointer. @@ -104,10 +105,9 @@ static BlockJob *test_block_job_start(unsigned int iterations, s->use_timer = use_timer; s->rc = rc; s->result = result; - s->common.co = qemu_coroutine_create(test_block_job_run, s); data->job = s; data->result = result; - qemu_coroutine_enter(s->common.co); + block_job_start(&s->common); return &s->common; } |