job: Move coroutine and related code to Job

This commit moves some core functions for dealing with the job coroutine
from BlockJob to Job. This includes primarily entering the coroutine
(both for the first and reentering) and yielding explicitly and at pause
points.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Kevin Wolf
2018-04-13 17:31:02 +02:00
parent 1908a5590c
commit da01ff7f38
14 changed files with 305 additions and 299 deletions

View File

@ -1910,7 +1910,7 @@ static void drive_backup_commit(BlkActionState *common)
aio_context_acquire(aio_context);
assert(state->job);
block_job_start(state->job);
job_start(&state->job->job);
aio_context_release(aio_context);
}
@ -2008,7 +2008,7 @@ static void blockdev_backup_commit(BlkActionState *common)
aio_context_acquire(aio_context);
assert(state->job);
block_job_start(state->job);
job_start(&state->job->job);
aio_context_release(aio_context);
}
@ -3425,7 +3425,7 @@ void qmp_drive_backup(DriveBackup *arg, Error **errp)
BlockJob *job;
job = do_drive_backup(arg, NULL, errp);
if (job) {
block_job_start(job);
job_start(&job->job);
}
}
@ -3513,7 +3513,7 @@ void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp)
BlockJob *job;
job = do_blockdev_backup(arg, NULL, errp);
if (job) {
block_job_start(job);
job_start(&job->job);
}
}