aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockdev.c6
-rw-r--r--blockjob.c5
-rw-r--r--include/block/blockjob.h7
-rw-r--r--qemu-img.c2
4 files changed, 16 insertions, 4 deletions
diff --git a/blockdev.c b/blockdev.c
index 0eb2823..b5ff9b8 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3315,7 +3315,7 @@ static BlockJob *find_block_job(const char *id, AioContext **aio_context,
return NULL;
}
- *aio_context = blk_get_aio_context(job->blk);
+ *aio_context = block_job_get_aio_context(job);
aio_context_acquire(*aio_context);
return job;
@@ -3420,7 +3420,7 @@ void qmp_block_job_finalize(const char *id, Error **errp)
* automatically acquires the new one), so make sure we release the correct
* one.
*/
- aio_context = blk_get_aio_context(job->blk);
+ aio_context = block_job_get_aio_context(job);
job_unref(&job->job);
aio_context_release(aio_context);
}
@@ -3711,7 +3711,7 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp)
if (block_job_is_internal(job)) {
continue;
}
- aio_context = blk_get_aio_context(job->blk);
+ aio_context = block_job_get_aio_context(job);
aio_context_acquire(aio_context);
value = block_job_query(job, errp);
aio_context_release(aio_context);
diff --git a/blockjob.c b/blockjob.c
index 4bad140..70bc310 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -547,3 +547,8 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
}
return action;
}
+
+AioContext *block_job_get_aio_context(BlockJob *job)
+{
+ return job->job.aio_context;
+}
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index d200f33..3b84805 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -173,4 +173,11 @@ bool block_job_is_internal(BlockJob *job);
*/
const BlockJobDriver *block_job_driver(BlockJob *job);
+/*
+ * block_job_get_aio_context:
+ *
+ * Returns aio context associated with a block job.
+ */
+AioContext *block_job_get_aio_context(BlockJob *job);
+
#endif
diff --git a/qemu-img.c b/qemu-img.c
index f036a1d..21ba1e6 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -902,7 +902,7 @@ static void common_block_job_cb(void *opaque, int ret)
static void run_block_job(BlockJob *job, Error **errp)
{
uint64_t progress_current, progress_total;
- AioContext *aio_context = blk_get_aio_context(job->blk);
+ AioContext *aio_context = block_job_get_aio_context(job);
int ret = 0;
aio_context_acquire(aio_context);