[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v10 06/21] job: move and update comments from blockjob.c
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v10 06/21] job: move and update comments from blockjob.c |
Date: |
Mon, 25 Jul 2022 03:38:40 -0400 |
This comment applies more on job, it was left in blockjob as in the past
the whole job logic was implemented there.
Note: at this stage, job_{lock/unlock} and job lock guard macros
are *nop*.
No functional change intended.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
blockjob.c | 20 --------------------
job.c | 14 ++++++++++++++
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/blockjob.c b/blockjob.c
index 4868453d74..7da59a1f1c 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -36,21 +36,6 @@
#include "qemu/main-loop.h"
#include "qemu/timer.h"
-/*
- * The block job API is composed of two categories of functions.
- *
- * The first includes functions used by the monitor. The monitor is
- * peculiar in that it accesses the block job list with block_job_get, and
- * therefore needs consistency across block_job_get and the actual operation
- * (e.g. block_job_set_speed). The consistency is achieved with
- * aio_context_acquire/release. These functions are declared in blockjob.h.
- *
- * The second includes functions used by the block job drivers and sometimes
- * by the core block layer. These do not care about locking, because the
- * whole coroutine runs under the AioContext lock, and are declared in
- * blockjob_int.h.
- */
-
static bool is_block_job(Job *job)
{
return job_type(job) == JOB_TYPE_BACKUP ||
@@ -433,11 +418,6 @@ static void block_job_event_ready(Notifier *n, void
*opaque)
}
-/*
- * API for block job drivers and the block layer. These functions are
- * declared in blockjob_int.h.
- */
-
void *block_job_create(const char *job_id, const BlockJobDriver *driver,
JobTxn *txn, BlockDriverState *bs, uint64_t perm,
uint64_t shared_perm, int64_t speed, int flags,
diff --git a/job.c b/job.c
index ae25db97ac..ebaa4e585b 100644
--- a/job.c
+++ b/job.c
@@ -32,6 +32,20 @@
#include "trace/trace-root.h"
#include "qapi/qapi-events-job.h"
+/*
+ * The job API is composed of two categories of functions.
+ *
+ * The first includes functions used by the monitor. The monitor is
+ * peculiar in that it accesses the block job list with job_get, and
+ * therefore needs consistency across job_get and the actual operation
+ * (e.g. job_user_cancel). To achieve this consistency, the caller
+ * calls job_lock/job_unlock itself around the whole operation.
+ *
+ *
+ * The second includes functions used by the block job drivers and sometimes
+ * by the core block layer. These delegate the locking to the callee instead.
+ */
+
/*
* job_mutex protects the jobs list, but also makes the
* struct job fields thread-safe.
--
2.31.1
- [PATCH v10 00/21] job: replace AioContext lock with job_mutex, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 02/21] job.h: categorize fields in struct Job, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 04/21] aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 03/21] job.c: API functions not used outside should be static, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 01/21] job.c: make job_mutex and job_lock/unlock() public, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 06/21] job: move and update comments from blockjob.c,
Emanuele Giuseppe Esposito <=
- [PATCH v10 11/21] jobs: group together API calls under the same job lock, Emanuele Giuseppe Esposito, 2022/07/25
- [PATCH v10 07/21] blockjob: introduce block_job _locked() APIs, Emanuele Giuseppe Esposito, 2022/07/25
- [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