mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06:00
quorum: implement .bdrv_detach/attach_aio_context()
Implement .bdrv_detach/attach_aio_context() interfaces to propagate detach/attach to BDRVQuorumState->bs[] children. The block layer takes care of ->file and ->backing_hd but doesn't know about our ->bs[] BlockDriverStates, which is also part of the graph. Reviewed-by: Benoît Canet <benoit.canet@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a8c868c386
commit
e3625d3d6a
1 changed files with 36 additions and 12 deletions
|
@ -848,6 +848,27 @@ static void quorum_close(BlockDriverState *bs)
|
||||||
g_free(s->bs);
|
g_free(s->bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void quorum_detach_aio_context(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
BDRVQuorumState *s = bs->opaque;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < s->num_children; i++) {
|
||||||
|
bdrv_detach_aio_context(s->bs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void quorum_attach_aio_context(BlockDriverState *bs,
|
||||||
|
AioContext *new_context)
|
||||||
|
{
|
||||||
|
BDRVQuorumState *s = bs->opaque;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < s->num_children; i++) {
|
||||||
|
bdrv_attach_aio_context(s->bs[i], new_context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static BlockDriver bdrv_quorum = {
|
static BlockDriver bdrv_quorum = {
|
||||||
.format_name = "quorum",
|
.format_name = "quorum",
|
||||||
.protocol_name = "quorum",
|
.protocol_name = "quorum",
|
||||||
|
@ -865,6 +886,9 @@ static BlockDriver bdrv_quorum = {
|
||||||
.bdrv_aio_writev = quorum_aio_writev,
|
.bdrv_aio_writev = quorum_aio_writev,
|
||||||
.bdrv_invalidate_cache = quorum_invalidate_cache,
|
.bdrv_invalidate_cache = quorum_invalidate_cache,
|
||||||
|
|
||||||
|
.bdrv_detach_aio_context = quorum_detach_aio_context,
|
||||||
|
.bdrv_attach_aio_context = quorum_attach_aio_context,
|
||||||
|
|
||||||
.is_filter = true,
|
.is_filter = true,
|
||||||
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
|
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue