[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 28/33] job.h: split function pointers in JobDriver
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v6 28/33] job.h: split function pointers in JobDriver |
Date: |
Fri, 21 Jan 2022 12:05:39 -0500 |
The job API will be handled separately in another serie.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
include/qemu/job.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/qemu/job.h b/include/qemu/job.h
index 6e67b6977f..4ea7a4a0cd 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -169,6 +169,12 @@ typedef struct Job {
* Callbacks and other information about a Job driver.
*/
struct JobDriver {
+
+ /*
+ * These fields are initialized when this object is created,
+ * and are never changed afterwards
+ */
+
/** Derived Job struct size */
size_t instance_size;
@@ -184,9 +190,18 @@ struct JobDriver {
* aborted. If it returns zero, the job moves into the WAITING state. If it
* is the last job to complete in its transaction, all jobs in the
* transaction move from WAITING to PENDING.
+ *
+ * This callback must be run in the job's context.
*/
int coroutine_fn (*run)(Job *job, Error **errp);
+ /*
+ * Functions run without regard to the BQL that may run in any
+ * arbitrary thread. These functions do not need to be thread-safe
+ * because the caller ensures that they are invoked from one
+ * thread at time.
+ */
+
/**
* If the callback is not NULL, it will be invoked when the job transitions
* into the paused state. Paused jobs must not perform any asynchronous
@@ -201,6 +216,13 @@ struct JobDriver {
*/
void coroutine_fn (*resume)(Job *job);
+ /*
+ * Global state (GS) API. These functions run under the BQL lock.
+ *
+ * See include/block/block-global-state.h for more information about
+ * the GS API.
+ */
+
/**
* Called when the job is resumed by the user (i.e. user_paused becomes
* false). .user_resume is called before .resume.
--
2.31.1
- [PATCH v6 19/33] block: introduce bdrv_activate, (continued)
- [PATCH v6 19/33] block: introduce bdrv_activate, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 17/33] include/block/snapshot: global state API + assertions, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 21/33] block: move BQL logic of bdrv_co_invalidate_cache in bdrv_activate, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 31/33] include/qemu/job.h: introduce job->pre_run() and use it in amend, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 26/33] block_int-common.h: assertions in the callers of BdrvChildClass function pointers, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 28/33] job.h: split function pointers in JobDriver,
Emanuele Giuseppe Esposito <=
- [PATCH v6 25/33] block_int-common.h: split function pointers in BdrvChildClass, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 30/33] include/block/block_int-common.h: introduce bdrv_amend_pre_run and bdrv_amend_clean, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 27/33] block-backend-common.h: split function pointers in BlockDevOps, Emanuele Giuseppe Esposito, 2022/01/21
- [PATCH v6 32/33] crypto: delegate permission functions to JobDriver .pre_run, Emanuele Giuseppe Esposito, 2022/01/21