aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2022-09-26 05:32:00 -0400
committerKevin Wolf <kwolf@redhat.com>2022-10-07 12:11:41 +0200
commitf41ab73fa283f4f4d79102d1c8e8bad456218751 (patch)
tree33c0afe14eda6d747bbd3d99e9c267908562b48a /include
parentbf61c583fc04b7fcfeeccec9be0044c85daac796 (diff)
downloadqemu-f41ab73fa283f4f4d79102d1c8e8bad456218751.zip
qemu-f41ab73fa283f4f4d79102d1c8e8bad456218751.tar.gz
qemu-f41ab73fa283f4f4d79102d1c8e8bad456218751.tar.bz2
blockjob: introduce block_job _locked() APIs
Just as done with job.h, create _locked() functions in blockjob.h These functions will be later useful when caller has already taken the lock. All blockjob _locked functions call job _locked functions. Note: at this stage, job_{lock/unlock} and job lock guard macros are *nop*. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220926093214.506243-8-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/blockjob.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 6525e16..8b65d39 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -92,6 +92,9 @@ typedef struct BlockJob {
*/
BlockJob *block_job_next(BlockJob *job);
+/* Same as block_job_next(), but called with job lock held. */
+BlockJob *block_job_next_locked(BlockJob *job);
+
/**
* block_job_get:
* @id: The id of the block job.
@@ -102,6 +105,9 @@ BlockJob *block_job_next(BlockJob *job);
*/
BlockJob *block_job_get(const char *id);
+/* Same as block_job_get(), but called with job lock held. */
+BlockJob *block_job_get_locked(const char *id);
+
/**
* block_job_add_bdrv:
* @job: A block job
@@ -145,6 +151,12 @@ bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs);
*/
bool block_job_set_speed(BlockJob *job, int64_t speed, Error **errp);
+/*
+ * Same as block_job_set_speed(), but called with job lock held.
+ * Might release the lock temporarily.
+ */
+bool block_job_set_speed_locked(BlockJob *job, int64_t speed, Error **errp);
+
/**
* block_job_query:
* @job: The job to get information about.
@@ -153,6 +165,9 @@ bool block_job_set_speed(BlockJob *job, int64_t speed, Error **errp);
*/
BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
+/* Same as block_job_query(), but called with job lock held. */
+BlockJobInfo *block_job_query_locked(BlockJob *job, Error **errp);
+
/**
* block_job_iostatus_reset:
* @job: The job whose I/O status should be reset.
@@ -162,6 +177,9 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
*/
void block_job_iostatus_reset(BlockJob *job);
+/* Same as block_job_iostatus_reset(), but called with job lock held. */
+void block_job_iostatus_reset_locked(BlockJob *job);
+
/*
* block_job_get_aio_context:
*