[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 36/42] job: Add job_transition_to_ready()
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH 36/42] job: Add job_transition_to_ready() |
Date: |
Mon, 14 May 2018 23:22:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
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 <address@hidden>
> ---
> 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 <address@hidden>
> + 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
- [Qemu-block] [PATCH 34/42] job: Add job_dismiss(), (continued)
- [Qemu-block] [PATCH 36/42] job: Add job_transition_to_ready(), Kevin Wolf, 2018/05/09
- Re: [Qemu-block] [PATCH 36/42] job: Add job_transition_to_ready(),
Max Reitz <=
- [Qemu-block] [PATCH 35/42] job: Add job_is_ready(), Kevin Wolf, 2018/05/09
- [Qemu-block] [PATCH 37/42] job: Move progress fields to Job, Kevin Wolf, 2018/05/09
- [Qemu-block] [PATCH 39/42] job: Add lifecycle QMP commands, Kevin Wolf, 2018/05/09
[Qemu-block] [PATCH 40/42] job: Add query-jobs QMP command, Kevin Wolf, 2018/05/09