From 463e0be101cb5a78ca6ee517d58604c3f3637bcd Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 16 Jun 2016 17:56:27 +0100 Subject: 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 Reviewed-by: Paolo Bonzini Reviewed-by: Fam Zheng Message-id: 1466096189-6477-7-git-send-email-stefanha@redhat.com --- include/block/blockjob.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 7739f37c3a..7dc720c82b 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -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; /** -- cgit v1.2.3