blockjob: add AioContext attached callback

Block jobs that use additional BDSes or event loop resources need a
callback to get their affairs in order when the AioContext is switched.

Simple block jobs don't need an attach callback, they automatically work
thanks to the generic attach/detach notifiers that this patch adds.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1466096189-6477-7-git-send-email-stefanha@redhat.com
This commit is contained in:
Stefan Hajnoczi 2016-06-16 17:56:27 +01:00
parent e8a095dadb
commit 463e0be101
2 changed files with 45 additions and 0 deletions

View file

@ -84,6 +84,13 @@ typedef struct BlockJobDriver {
* should be restarted from this callback.
*/
void coroutine_fn (*resume)(BlockJob *job);
/*
* If the callback is not NULL, it will be invoked before the job is
* resumed in a new AioContext. This is the place to move any resources
* besides job->blk to the new AioContext.
*/
void (*attached_aio_context)(BlockJob *job, AioContext *new_context);
} BlockJobDriver;
/**