summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2016-05-17 13:38:04 +0200
committerKevin Wolf <kwolf@redhat.com>2016-05-19 16:45:31 +0200
commitb97511c7bc88bc487cacbfab349eb6023ae4f49b (patch)
treea66bd28420c031273e74416a90f2eb923347dada /block.c
parent1f0c461b82d5ec2664ca0cfc9548f80da87a8f8a (diff)
downloadqemu-b97511c7bc88bc487cacbfab349eb6023ae4f49b.tar.gz
block: Propagate AioContext change to all children
Instead of propagating any change of a BDS's AioContext only to its file and backing children and letting driver-specific code do the rest, just propagate it to all and drop the thus superfluous implementations of bdrv_{at,de}tach_aio_context() in Quorum, blkverify and VMDK. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/block.c b/block.c
index cbc10f7480..1205ef8860 100644
--- a/block.c
+++ b/block.c
@@ -3609,6 +3609,7 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs)
void bdrv_detach_aio_context(BlockDriverState *bs)
{
BdrvAioNotifier *baf;
+ BdrvChild *child;
if (!bs->drv) {
return;
@@ -3621,11 +3622,8 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
if (bs->drv->bdrv_detach_aio_context) {
bs->drv->bdrv_detach_aio_context(bs);
}
- if (bs->file) {
- bdrv_detach_aio_context(bs->file->bs);
- }
- if (bs->backing) {
- bdrv_detach_aio_context(bs->backing->bs);
+ QLIST_FOREACH(child, &bs->children, next) {
+ bdrv_detach_aio_context(child->bs);
}
bs->aio_context = NULL;
@@ -3635,6 +3633,7 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
AioContext *new_context)
{
BdrvAioNotifier *ban;
+ BdrvChild *child;
if (!bs->drv) {
return;
@@ -3642,11 +3641,8 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
bs->aio_context = new_context;
- if (bs->backing) {
- bdrv_attach_aio_context(bs->backing->bs, new_context);
- }
- if (bs->file) {
- bdrv_attach_aio_context(bs->file->bs, new_context);
+ QLIST_FOREACH(child, &bs->children, next) {
+ bdrv_attach_aio_context(child->bs, new_context);
}
if (bs->drv->bdrv_attach_aio_context) {
bs->drv->bdrv_attach_aio_context(bs, new_context);