On 2018-05-09 18:26, Kevin Wolf wrote: > The transition to the READY state was still performed in the BlockJob > layer, in the same function that sent the BLOCK_JOB_READY QMP event. > > This patch brings the state transition to the Job layer and implements > the QMP event using a notifier called from the Job layer, like we > already do for other events related to state transitions. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > include/block/blockjob.h | 3 +++ > include/block/blockjob_int.h | 8 -------- > include/qemu/job.h | 9 ++++++--- > block/mirror.c | 6 +++--- > blockjob.c | 36 +++++++++++++++++++----------------- > job.c | 16 +++++++++++++--- > tests/test-bdrv-drain.c | 2 +- > tests/test-blockjob.c | 2 +- > 8 files changed, 46 insertions(+), 36 deletions(-)
[...] > diff --git a/include/qemu/job.h b/include/qemu/job.h > index fb81cc7c09..20b48926d9 100644 > --- a/include/qemu/job.h > +++ b/include/qemu/job.h [...] > @@ -522,7 +528,4 @@ void job_defer_to_main_loop(Job *job, > JobDeferToMainLoopFn *fn, void *opaque); > */ > int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error > **errp); > > -/* TODO To be removed from the public interface */ > -void job_state_transition(Job *job, JobStatus s1); > - \o/ > #endif [...] > diff --git a/blockjob.c b/blockjob.c > index 0512b41901..27f3199a20 100644 > --- a/blockjob.c > +++ b/blockjob.c [...] > @@ -387,13 +403,14 @@ void *block_job_create(const char *job_id, const > BlockJobDriver *driver, > job->finalize_cancelled_notifier.notify = block_job_event_cancelled; > job->finalize_completed_notifier.notify = block_job_event_completed; > job->pending_notifier.notify = block_job_event_pending; > + job->ready_notifier.notify = block_job_event_ready; > > notifier_list_add(&job->job.on_finalize_cancelled, > &job->finalize_cancelled_notifier); > notifier_list_add(&job->job.on_finalize_completed, > &job->finalize_completed_notifier); > - notifier_list_add(&job->job.on_pending, > - &job->pending_notifier); > + notifier_list_add(&job->job.on_pending, &job->pending_notifier); Do you want to move this to the patch that introduced this line? If you do: Reviewed-by: Max Reitz <mre...@redhat.com> > + notifier_list_add(&job->job.on_ready, &job->ready_notifier); > > error_setg(&job->blocker, "block device is in use by block job: %s", > job_type_str(&job->job));
signature.asc
Description: OpenPGP digital signature