[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 44/50] job.h: assertions in the callers of JobDriver function poin
From: |
Kevin Wolf |
Subject: |
[PULL 44/50] job.h: assertions in the callers of JobDriver function pointers |
Date: |
Fri, 4 Mar 2022 17:47:05 +0100 |
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20220303151616.325444-32-eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
job.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/job.c b/job.c
index 54db80df66..075c6f3a20 100644
--- a/job.c
+++ b/job.c
@@ -381,6 +381,8 @@ void job_ref(Job *job)
void job_unref(Job *job)
{
+ GLOBAL_STATE_CODE();
+
if (--job->refcnt == 0) {
assert(job->status == JOB_STATUS_NULL);
assert(!timer_pending(&job->sleep_timer));
@@ -602,6 +604,7 @@ bool job_user_paused(Job *job)
void job_user_resume(Job *job, Error **errp)
{
assert(job);
+ GLOBAL_STATE_CODE();
if (!job->user_paused || job->pause_count <= 0) {
error_setg(errp, "Can't resume a job that was not paused");
return;
@@ -672,6 +675,7 @@ static void job_update_rc(Job *job)
static void job_commit(Job *job)
{
assert(!job->ret);
+ GLOBAL_STATE_CODE();
if (job->driver->commit) {
job->driver->commit(job);
}
@@ -680,6 +684,7 @@ static void job_commit(Job *job)
static void job_abort(Job *job)
{
assert(job->ret);
+ GLOBAL_STATE_CODE();
if (job->driver->abort) {
job->driver->abort(job);
}
@@ -687,6 +692,7 @@ static void job_abort(Job *job)
static void job_clean(Job *job)
{
+ GLOBAL_STATE_CODE();
if (job->driver->clean) {
job->driver->clean(job);
}
@@ -726,6 +732,7 @@ static int job_finalize_single(Job *job)
static void job_cancel_async(Job *job, bool force)
{
+ GLOBAL_STATE_CODE();
if (job->driver->cancel) {
force = job->driver->cancel(job, force);
} else {
@@ -825,6 +832,7 @@ static void job_completed_txn_abort(Job *job)
static int job_prepare(Job *job)
{
+ GLOBAL_STATE_CODE();
if (job->ret == 0 && job->driver->prepare) {
job->ret = job->driver->prepare(job);
job_update_rc(job);
@@ -952,6 +960,7 @@ static void coroutine_fn job_co_entry(void *opaque)
Job *job = opaque;
assert(job && job->driver && job->driver->run);
+ assert(job->aio_context == qemu_get_current_aio_context());
job_pause_point(job);
job->ret = job->driver->run(job, &job->err);
job->deferred_to_main_loop = true;
@@ -1054,6 +1063,7 @@ void job_complete(Job *job, Error **errp)
{
/* Should not be reachable via external interface for internal jobs */
assert(job->id);
+ GLOBAL_STATE_CODE();
if (job_apply_verb(job, JOB_VERB_COMPLETE, errp)) {
return;
}
--
2.35.1
- [PULL 36/50] block/copy-before-write.h: global state API + assertions, (continued)
- [PULL 36/50] block/copy-before-write.h: global state API + assertions, Kevin Wolf, 2022/03/04
- [PULL 34/50] assertions for blockdev.h global state API, Kevin Wolf, 2022/03/04
- [PULL 35/50] include/block/snapshot: global state API + assertions, Kevin Wolf, 2022/03/04
- [PULL 37/50] block/coroutines: I/O and "I/O or GS" API, Kevin Wolf, 2022/03/04
- [PULL 39/50] block_int-common.h: assertions in the callers of BlockDriver function pointers, Kevin Wolf, 2022/03/04
- [PULL 38/50] block_int-common.h: split function pointers in BlockDriver, Kevin Wolf, 2022/03/04
- [PULL 40/50] block_int-common.h: split function pointers in BdrvChildClass, Kevin Wolf, 2022/03/04
- [PULL 43/50] job.h: split function pointers in JobDriver, Kevin Wolf, 2022/03/04
- [PULL 41/50] block_int-common.h: assertions in the callers of BdrvChildClass function pointers, Kevin Wolf, 2022/03/04
- [PULL 42/50] block-backend-common.h: split function pointers in BlockDevOps, Kevin Wolf, 2022/03/04
- [PULL 44/50] job.h: assertions in the callers of JobDriver function pointers,
Kevin Wolf <=
- [PULL 46/50] iotests: Allow using QMP with the QSD, Kevin Wolf, 2022/03/04
- [PULL 45/50] block: Make bdrv_refresh_limits() non-recursive, Kevin Wolf, 2022/03/04
- [PULL 47/50] iotests/graph-changes-while-io: New test, Kevin Wolf, 2022/03/04
- [PULL 49/50] block/amend: Always call .bdrv_amend_clean(), Kevin Wolf, 2022/03/04
- [PULL 50/50] block/amend: Keep strong reference to BDS, Kevin Wolf, 2022/03/04
- [PULL 48/50] tests/qemu-iotests: Rework the checks and spots using GNU sed, Kevin Wolf, 2022/03/04
- Re: [PULL 00/50] Block layer patches, Peter Maydell, 2022/03/05