diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-10-05 17:58:55 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-10-09 07:08:20 +0200 |
commit | eb94b81a94bce112e6b206df846c1551aaf6cab6 (patch) | |
tree | 50a7bf08af03d1f2c17392ef48c80a56380d2397 /qapi | |
parent | 18c6ac1c6eb7cc541249585836659d0d3ed3a539 (diff) |
block: Convert 'block_resize' to coroutine
block_resize performs some I/O that could potentially take quite some
time, so use it as an example for the new 'coroutine': true annotation
in the QAPI schema.
bdrv_truncate() requires that we're already in the right AioContext for
the BlockDriverState if called in coroutine context. So instead of just
taking the AioContext lock, move the QMP handler coroutine to the
context.
Call blk_unref() only after switching back because blk_unref() may only
be called in the main thread.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201005155855.256490-15-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/block-core.json | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qapi/block-core.json b/qapi/block-core.json index 3758ea9912..ee5ebef7f2 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1310,7 +1310,8 @@ { 'command': 'block_resize', 'data': { '*device': 'str', '*node-name': 'str', - 'size': 'int' } } + 'size': 'int' }, + 'coroutine': true } ## # @NewImageMode: |