[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 08/15] job.c: minor adjustments in preparation to job-driver
From: |
Emanuele Giuseppe Esposito |
Subject: |
[RFC PATCH 08/15] job.c: minor adjustments in preparation to job-driver |
Date: |
Fri, 29 Oct 2021 12:39:07 -0400 |
job_event_* functions can be all static, as they are not used
outside job.c
Add also missing notifier initialization for the on_idle
list in job_create().
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
job.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/job.c b/job.c
index db7ad79745..88d911f2d7 100644
--- a/job.c
+++ b/job.c
@@ -464,6 +464,7 @@ void *job_create(const char *job_id, const JobDriver
*driver, JobTxn *txn,
notifier_list_init(&job->on_finalize_completed);
notifier_list_init(&job->on_pending);
notifier_list_init(&job->on_ready);
+ notifier_list_init(&job->on_idle);
job_state_transition(job, JOB_STATUS_CREATED);
aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
@@ -527,12 +528,20 @@ void job_progress_increase_remaining(Job *job, uint64_t
delta)
progress_increase_remaining(&job->progress, delta);
}
-void job_event_cancelled(Job *job)
+/**
+ * To be called when a cancelled job is finalised.
+ * Called with job_mutex held.
+ */
+static void job_event_cancelled(Job *job)
{
notifier_list_notify(&job->on_finalize_cancelled, job);
}
-void job_event_completed(Job *job)
+/**
+ * To be called when a successfully completed job is finalised.
+ * Called with job_mutex held.
+ */
+static void job_event_completed(Job *job)
{
notifier_list_notify(&job->on_finalize_completed, job);
}
--
2.27.0
- [RFC PATCH 04/15] jobs: add job-monitor.h, (continued)
- [RFC PATCH 04/15] jobs: add job-monitor.h, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 05/15] job-monitor.h: define the job monitor API, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 06/15] jobs: add job-driver.h, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 09/15] job.c: move inner aiocontext lock in callbacks, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 07/15] job-driver.h: add helper functions, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 14/15] jobs: add missing job locks to replace aiocontext lock, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 15/15] jobs: remove all unnecessary AioContext locks, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 10/15] aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 13/15] jobs: use job locks and helpers also in the unit tests, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 12/15] jobs: protect jobs with job_lock/unlock, Emanuele Giuseppe Esposito, 2021/10/29
- [RFC PATCH 08/15] job.c: minor adjustments in preparation to job-driver,
Emanuele Giuseppe Esposito <=
- [RFC PATCH 11/15] jobs: remove aiocontext locks since the functions are under BQL, Emanuele Giuseppe Esposito, 2021/10/29