[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/6] block: Add AioContextNotifier functions to B
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v2 2/6] block: Add AioContextNotifier functions to BB |
Date: |
Tue, 18 Nov 2014 12:21:15 +0100 |
Because all BlockDriverStates behind a single BlockBackend reside in a
single AioContext, it is fine to just pass these functions
(blk_add_aio_context_notifier() and blk_remove_aio_context_notifier())
through to the root BlockDriverState.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
block/block-backend.c | 18 ++++++++++++++++++
include/sysemu/block-backend.h | 8 ++++++++
2 files changed, 26 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index 89f69b7..7a7f690 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -624,6 +624,24 @@ void blk_set_aio_context(BlockBackend *blk, AioContext
*new_context)
bdrv_set_aio_context(blk->bs, new_context);
}
+void blk_add_aio_context_notifier(BlockBackend *blk,
+ void (*attached_aio_context)(AioContext *new_context, void *opaque),
+ void (*detach_aio_context)(void *opaque), void *opaque)
+{
+ bdrv_add_aio_context_notifier(blk->bs, attached_aio_context,
+ detach_aio_context, opaque);
+}
+
+void blk_remove_aio_context_notifier(BlockBackend *blk,
+ void (*attached_aio_context)(AioContext *,
+ void *),
+ void (*detach_aio_context)(void *),
+ void *opaque)
+{
+ bdrv_remove_aio_context_notifier(blk->bs, attached_aio_context,
+ detach_aio_context, opaque);
+}
+
void blk_io_plug(BlockBackend *blk)
{
bdrv_io_plug(blk->bs);
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 0c46b82..d9c1337 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -135,6 +135,14 @@ void blk_op_block_all(BlockBackend *blk, Error *reason);
void blk_op_unblock_all(BlockBackend *blk, Error *reason);
AioContext *blk_get_aio_context(BlockBackend *blk);
void blk_set_aio_context(BlockBackend *blk, AioContext *new_context);
+void blk_add_aio_context_notifier(BlockBackend *blk,
+ void (*attached_aio_context)(AioContext *new_context, void *opaque),
+ void (*detach_aio_context)(void *opaque), void *opaque);
+void blk_remove_aio_context_notifier(BlockBackend *blk,
+ void (*attached_aio_context)(AioContext *,
+ void *),
+ void (*detach_aio_context)(void *),
+ void *opaque);
void blk_io_plug(BlockBackend *blk);
void blk_io_unplug(BlockBackend *blk);
BlockAcctStats *blk_get_stats(BlockBackend *blk);
--
1.9.3
- [Qemu-devel] [PATCH v2 0/6] nbd: Use BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 1/6] block: Lift more functions into BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 2/6] block: Add AioContextNotifier functions to BB,
Max Reitz <=
- [Qemu-devel] [PATCH v2 4/6] nbd: Change external interface to BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 3/6] block: Add blk_add_close_notifier() for BB, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 5/6] nbd: Use BlockBackend internally, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 6/6] qemu-nbd: Use BlockBackend where reasonable, Max Reitz, 2014/11/18
- Re: [Qemu-devel] [PATCH v2 0/6] nbd: Use BlockBackend, Stefan Hajnoczi, 2014/11/26