blockjob: implement and use block_job_get_aio_context
We are going to drop BlockJob.blk. So let's retrieve block job context from underlying job instead of main node. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Nikita Lapshin <nikita.lapshin@virtuozzo.com>
This commit is contained in:
parent
252f40913a
commit
df9a316505
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user