[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 05/25] block/block-backend.c: assertions for block-backend
From: |
Hanna Reitz |
Subject: |
Re: [PATCH v4 05/25] block/block-backend.c: assertions for block-backend |
Date: |
Fri, 12 Nov 2021 12:01:36 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
On 25.10.21 12:17, Emanuele Giuseppe Esposito wrote:
All the global state (GS) API functions will check that
qemu_in_main_thread() returns true. If not, it means
that the safety of BQL cannot be guaranteed, and
they need to be moved to I/O.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/block-backend.c | 90 +++++++++++++++++++++++++++++++++++++++++-
softmmu/qdev-monitor.c | 2 +
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 0afc03fd66..ed45576007 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
[...]
@@ -1550,6 +1596,7 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t
offset,
void blk_aio_cancel(BlockAIOCB *acb)
{
+ assert(qemu_in_main_thread());
bdrv_aio_cancel(acb);
}
This function is in block-backend-io.h, though.
[...]
@@ -1879,7 +1936,6 @@ void blk_invalidate_cache(BlockBackend *blk, Error **errp)
bool blk_is_inserted(BlockBackend *blk)
{
BlockDriverState *bs = blk_bs(blk);
-
return bs && bdrv_is_inserted(bs);
}
Seems like an unrelated hunk.
[...]
@@ -2443,11 +2529,13 @@ int coroutine_fn blk_co_copy_range(BlockBackend
*blk_in, int64_t off_in,
[…]
int blk_make_empty(BlockBackend *blk, Error **errp)
{
+ assert(qemu_in_main_thread());
if (!blk_is_available(blk)) {
error_setg(errp, "No medium inserted");
return -ENOMEDIUM;
This function too is in block-backend-io.h.
Hanna
- Re: [PATCH v4 05/25] block/block-backend.c: assertions for block-backend,
Hanna Reitz <=