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 /block | |
parent | a7815a764c40c9dcf204f666c2d90248095376a8 (diff) | |
download | qemu-5ccac6f186e4a480074880d958760c7105cf9ba8.zip |
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 'block')
-rw-r--r-- | block/backup.c | 3 | ||||
-rw-r--r-- | block/commit.c | 5 | ||||
-rw-r--r-- | block/mirror.c | 5 | ||||
-rw-r--r-- | block/stream.c | 5 | ||||
-rw-r--r-- | block/trace-events | 6 |
5 files changed, 10 insertions, 14 deletions
diff --git a/block/backup.c b/block/backup.c index 4ed449448a..ae1b99aa84 100644 --- a/block/backup.c +++ b/block/backup.c @@ -654,9 +654,8 @@ void backup_start(const char *job_id, BlockDriverState *bs, block_job_add_bdrv(&job->common, target); job->common.len = len; - job->common.co = qemu_coroutine_create(job->common.driver->start, job); block_job_txn_add_job(txn, &job->common); - qemu_coroutine_enter(job->common.co); + block_job_start(&job->common); return; error: diff --git a/block/commit.c b/block/commit.c index 20d27e27a8..c284e8535d 100644 --- a/block/commit.c +++ b/block/commit.c @@ -289,10 +289,9 @@ void commit_start(const char *job_id, BlockDriverState *bs, s->backing_file_str = g_strdup(backing_file_str); s->on_error = on_error; - s->common.co = qemu_coroutine_create(s->common.driver->start, s); - trace_commit_start(bs, base, top, s, s->common.co); - qemu_coroutine_enter(s->common.co); + trace_commit_start(bs, base, top, s); + block_job_start(&s->common); } diff --git a/block/mirror.c b/block/mirror.c index 659e09cbaf..62ac87f0c4 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1009,9 +1009,8 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, } } - 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); + trace_mirror_start(bs, s, opaque); + block_job_start(&s->common); } void mirror_start(const char *job_id, BlockDriverState *bs, diff --git a/block/stream.c b/block/stream.c index 92309ffc2e..1523ba7dfb 100644 --- a/block/stream.c +++ b/block/stream.c @@ -255,7 +255,6 @@ void stream_start(const char *job_id, BlockDriverState *bs, s->bs_flags = orig_bs_flags; s->on_error = on_error; - s->common.co = qemu_coroutine_create(s->common.driver->start, s); - trace_stream_start(bs, base, s, s->common.co); - qemu_coroutine_enter(s->common.co); + trace_stream_start(bs, base, s); + block_job_start(&s->common); } diff --git a/block/trace-events b/block/trace-events index 882c9034c2..cfc05f2478 100644 --- a/block/trace-events +++ b/block/trace-events @@ -19,14 +19,14 @@ bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int64_t c # block/stream.c stream_one_iteration(void *s, int64_t sector_num, int nb_sectors, int is_allocated) "s %p sector_num %"PRId64" nb_sectors %d is_allocated %d" -stream_start(void *bs, void *base, void *s, void *co) "bs %p base %p s %p co %p" +stream_start(void *bs, void *base, void *s) "bs %p base %p s %p" # block/commit.c commit_one_iteration(void *s, int64_t sector_num, int nb_sectors, int is_allocated) "s %p sector_num %"PRId64" nb_sectors %d is_allocated %d" -commit_start(void *bs, void *base, void *top, void *s, void *co) "bs %p base %p top %p s %p co %p" +commit_start(void *bs, void *base, void *top, void *s) "bs %p base %p top %p s %p" # block/mirror.c -mirror_start(void *bs, void *s, void *co, void *opaque) "bs %p s %p co %p opaque %p" +mirror_start(void *bs, void *s, void *opaque) "bs %p s %p opaque %p" mirror_restart_iter(void *s, int64_t cnt) "s %p dirty count %"PRId64 mirror_before_flush(void *s) "s %p" mirror_before_drain(void *s, int64_t cnt) "s %p dirty count %"PRId64 |