block: Implement .(can_)set_aio_ctx for BlockBackend
commit38475269d4d9efcc5f1a5aae4834d165248ea13d
authorKevin Wolf <kwolf@redhat.com>
Mon, 6 May 2019 17:18:01 +0000 (6 19:18 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 20 May 2019 15:08:56 +0000 (20 17:08 +0200)
tree8b882ecc72c392752bff349221e72e97b00f9447
parent7e2f096a823f75ca3f1df1811c406b46254587fd
block: Implement .(can_)set_aio_ctx for BlockBackend

bdrv_try_set_aio_context() currently fails if a BlockBackend is attached
to a node because it doesn't implement the BdrvChildRole callbacks for
AioContext management.

We can allow changing the AioContext of monitor-owned BlockBackends as
long as no device is attached to them.

When setting the AioContext of the root node of a BlockBackend, we now
need to pass blk->root as an ignored child because we don't want the
root node to recursively call back into BlockBackend and execute
blk_do_set_aio_context() a second time.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c