mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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>
This commit is contained in:
parent
18c6ac1c6e
commit
eb94b81a94
3 changed files with 11 additions and 9 deletions
|
@ -76,6 +76,7 @@ ERST
|
|||
.params = "device size",
|
||||
.help = "resize a block image",
|
||||
.cmd = hmp_block_resize,
|
||||
.coroutine = true,
|
||||
},
|
||||
|
||||
SRST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue