diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2014-05-08 16:34:37 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-06-04 09:56:11 +0200 |
commit | dcd042282d855edf70df90b7d61d33b515320b7a (patch) | |
tree | 51fc223c7a07e6b90230f7ab9b0ce12cbc32adbd /include/block/block.h | |
parent | 9b536adcbefb72090f43c9715ce042e37e47af73 (diff) | |
download | qemu-dcd042282d855edf70df90b7d61d33b515320b7a.tar.gz qemu-dcd042282d855edf70df90b7d61d33b515320b7a.tar.bz2 qemu-dcd042282d855edf70df90b7d61d33b515320b7a.zip |
block: add bdrv_set_aio_context()
Up until now all BlockDriverState instances have used the QEMU main loop
for fd handlers, timers, and BHs. This is not scalable on SMP guests
and hosts so we need to move to a model with multiple event loops on
different host CPUs.
bdrv_set_aio_context() assigns the AioContext event loop to use for a
particular BlockDriverState. It first detaches the entire
BlockDriverState graph from the current AioContext and then attaches to
the new AioContext.
This function will be used by virtio-blk data-plane to assign a
BlockDriverState to its IOThread AioContext. Make
bdrv_aio_set_context() public since data-plane should not include
block_int.h.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/block/block.h')
-rw-r--r-- | include/block/block.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/block/block.h b/include/block/block.h index faee3aa246..292754f9fe 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -574,4 +574,15 @@ int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag); int bdrv_debug_resume(BlockDriverState *bs, const char *tag); bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag); +/** + * bdrv_set_aio_context: + * + * Changes the #AioContext used for fd handlers, timers, and BHs by this + * BlockDriverState and all its children. + * + * This function must be called from the old #AioContext or with a lock held so + * the old #AioContext is not executing. + */ +void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context); + #endif |