On 02/23/2018 05:51 PM, John Snow wrote:
model all independent jobs as single job transactions.
It's one less case we have to worry about when we add more states to the
transition machine. This way, we can just treat all job lifetimes exactly
the same. This helps tighten assertions of the STM graph and removes some
conditionals that would have been needed in the coming commits adding a
more explicit job lifetime management API.
Signed-off-by: John Snow <js...@redhat.com>
---
Reviewed-by: Eric Blake <ebl...@redhat.com>
@@ -729,6 +727,17 @@ void *block_job_create(const char *job_id, const
BlockJobDriver *driver,
return NULL;
}
}
+
+ /* Single jobs are modeled as single-job transactions for sake of
+ * consolidating the job management logic */
+ if (!txn) {
+ txn = block_job_txn_new();
+ block_job_txn_add_job(txn, job);
+ block_job_txn_unref(txn);
+ } else {
+ block_job_txn_add_job(txn, job);
+ }
+
return job;
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org