[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v10 15/21] blockjob.h: categorize fields in struct BlockJob
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v10 15/21] blockjob.h: categorize fields in struct BlockJob |
Date: |
Mon, 25 Jul 2022 03:38:49 -0400 |
The same job lock is being used also to protect some of blockjob fields.
Categorize them just as done in job.h.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
include/block/blockjob.h | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 8b65d3949d..912e10b083 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -40,10 +40,16 @@ typedef struct BlockJobDriver BlockJobDriver;
* Long-running operation on a BlockDriverState.
*/
typedef struct BlockJob {
- /** Data belonging to the generic Job infrastructure */
+ /**
+ * Data belonging to the generic Job infrastructure.
+ * Protected by job mutex.
+ */
Job job;
- /** Status that is published by the query-block-jobs QMP API */
+ /**
+ * Status that is published by the query-block-jobs QMP API.
+ * Protected by job mutex.
+ */
BlockDeviceIoStatus iostatus;
/** Speed that was set with @block_job_set_speed. */
@@ -55,6 +61,8 @@ typedef struct BlockJob {
/** Block other operations when block job is running */
Error *blocker;
+ /** All notifiers are set once in block_job_create() and never modified. */
+
/** Called when a cancelled job is finalised. */
Notifier finalize_cancelled_notifier;
@@ -70,7 +78,10 @@ typedef struct BlockJob {
/** Called when the job coroutine yields or terminates */
Notifier idle_notifier;
- /** BlockDriverStates that are involved in this block job */
+ /**
+ * BlockDriverStates that are involved in this block job.
+ * Always modified and read under QEMU global mutex (GLOBAL_STATE_CODE)
+ */
GSList *nodes;
} BlockJob;
--
2.31.1
- [PATCH v10 08/21] jobs: add job lock in find_* functions, (continued)
- [PATCH v10 08/21] jobs: add job lock in find_* functions, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 09/21] jobs: use job locks also in the unit tests, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 10/21] block/mirror.c: use of job helpers in drivers to avoid TOC/TOU, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 16/21] blockjob: rename notifier callbacks as _locked, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 13/21] job: detect change of aiocontext within job coroutine, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 12/21] commit and mirror: create new nodes using bdrv_get_aio_context, and not the job aiocontext, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 05/21] job.c: add job_lock/unlock while keeping job.h intact, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 15/21] blockjob.h: categorize fields in struct BlockJob,
Emanuele Giuseppe Esposito <=
- [PATCH v10 18/21] job.c: enable job lock/unlock and remove Aiocontext locks, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 14/21] jobs: protect job.aio_context with BQL and job_mutex, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 17/21] blockjob: protect iostatus field in BlockJob struct, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 19/21] block_job_query: remove atomic read, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 21/21] job: remove unused functions, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 20/21] blockjob: remove unused functions, Emanuele Giuseppe Esposito, 2022/07/25