[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 42/50] blockjob.h: categorize fields in struct BlockJob
From: |
Kevin Wolf |
Subject: |
[PULL 42/50] blockjob.h: categorize fields in struct BlockJob |
Date: |
Fri, 7 Oct 2022 12:47:44 +0200 |
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
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>
Message-Id: <20220926093214.506243-15-eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/blockjob.h | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 8b65d3949d..10c24e240a 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -40,21 +40,38 @@ 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. */
+ /**
+ * Speed that was set with @block_job_set_speed.
+ * Always modified and read under QEMU global mutex (GLOBAL_STATE_CODE).
+ */
int64_t speed;
- /** Rate limiting data structure for implementing @speed. */
+ /**
+ * Rate limiting data structure for implementing @speed.
+ * RateLimit API is thread-safe.
+ */
RateLimit limit;
- /** Block other operations when block job is running */
+ /**
+ * Block other operations when block job is running.
+ * Always modified and read under QEMU global mutex (GLOBAL_STATE_CODE).
+ */
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 +87,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.37.3
- [PULL 13/50] nvme: add missing coroutine_fn annotations, (continued)
- [PULL 13/50] nvme: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 22/50] job: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 19/50] quorum: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 44/50] blockjob: protect iostatus field in BlockJob struct, Kevin Wolf, 2022/10/07
- [PULL 12/50] nfs: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 26/50] migration: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 05/50] qcow2: remove incorrect coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 09/50] file-posix: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 14/50] parallels: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 39/50] jobs: group together API calls under the same job lock, Kevin Wolf, 2022/10/07
- [PULL 42/50] blockjob.h: categorize fields in struct BlockJob,
Kevin Wolf <=
- [PULL 10/50] iscsi: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 18/50] qed: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 16/50] copy-before-write: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 29/50] job.c: make job_mutex and job_lock/unlock() public, Kevin Wolf, 2022/10/07
- [PULL 35/50] blockjob: introduce block_job _locked() APIs, Kevin Wolf, 2022/10/07
- [PULL 24/50] raw-format: add missing coroutine_fn annotations, Kevin Wolf, 2022/10/07
- [PULL 38/50] block/mirror.c: use of job helpers in drivers, Kevin Wolf, 2022/10/07
- [PULL 36/50] jobs: add job lock in find_* functions, Kevin Wolf, 2022/10/07
- [PULL 40/50] job: detect change of aiocontext within job coroutine, Kevin Wolf, 2022/10/07
- [PULL 50/50] file-posix: Remove unused s->discard_zeroes, Kevin Wolf, 2022/10/07