aboutsummaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2022-03-03 10:16:09 -0500
committerKevin Wolf <kwolf@redhat.com>2022-03-04 18:18:25 +0100
commit1581a70ddd0cd71a8520027d7136ed1e2f6bd19b (patch)
tree1959df08dca1a7e424448e52d4debdc7c5a97b74 /block/block-backend.c
parent377cc15bf1994a176162a5f705ff32a38aa55e2c (diff)
downloadqemu-1581a70ddd0cd71a8520027d7136ed1e2f6bd19b.zip
qemu-1581a70ddd0cd71a8520027d7136ed1e2f6bd19b.tar.gz
qemu-1581a70ddd0cd71a8520027d7136ed1e2f6bd19b.tar.bz2
block/coroutines: I/O and "I/O or GS" API
block coroutines functions run in different aiocontext, and are not protected by the BQL. Therefore are I/O. On the other side, generated_co_wrapper functions use BDRV_POLL_WHILE, meaning the caller can either be the main loop or a specific iothread. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20220303151616.325444-25-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index bf77c4a..e0e1aff 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1290,6 +1290,7 @@ blk_co_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes,
{
int ret;
BlockDriverState *bs;
+ IO_CODE();
blk_wait_while_drained(blk);
@@ -1337,6 +1338,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
{
int ret;
BlockDriverState *bs;
+ IO_CODE();
blk_wait_while_drained(blk);
@@ -1656,6 +1658,8 @@ void blk_aio_cancel_async(BlockAIOCB *acb)
int coroutine_fn
blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
{
+ IO_CODE();
+
blk_wait_while_drained(blk);
if (!blk_is_available(blk)) {
@@ -1699,6 +1703,7 @@ int coroutine_fn
blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
{
int ret;
+ IO_CODE();
blk_wait_while_drained(blk);
@@ -1757,6 +1762,7 @@ int blk_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
int coroutine_fn blk_co_do_flush(BlockBackend *blk)
{
blk_wait_while_drained(blk);
+ IO_CODE();
if (!blk_is_available(blk)) {
return -ENOMEDIUM;