[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 24/31] block_int-common.h: assertions in the callers of BdrvCh
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v5 24/31] block_int-common.h: assertions in the callers of BdrvChildClass function pointers |
Date: |
Wed, 24 Nov 2021 01:44:11 -0500 |
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block.c b/block.c
index 180884b8c0..a0309f827d 100644
--- a/block.c
+++ b/block.c
@@ -1491,6 +1491,7 @@ const BdrvChildClass child_of_bds = {
AioContext *bdrv_child_get_parent_aio_context(BdrvChild *c)
{
+ assert(qemu_in_main_thread());
return c->klass->get_parent_aio_context(c);
}
@@ -2120,6 +2121,7 @@ bool bdrv_is_writable(BlockDriverState *bs)
static char *bdrv_child_user_desc(BdrvChild *c)
{
+ assert(qemu_in_main_thread());
return c->klass->get_parent_desc(c);
}
@@ -2832,6 +2834,7 @@ static void bdrv_replace_child_noperm(BdrvChild **childp,
assert(!child->frozen);
assert(old_bs != new_bs);
+ assert(qemu_in_main_thread());
if (old_bs && new_bs) {
assert(bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs));
@@ -2928,6 +2931,7 @@ static void bdrv_attach_child_common_abort(void *opaque)
BdrvChild *child = *s->child;
BlockDriverState *bs = child->bs;
+ assert(qemu_in_main_thread());
/*
* Pass free_empty_child=false, because we still need the child
* for the AioContext operations on the parent below; those
@@ -3296,6 +3300,7 @@ void bdrv_unref_child(BlockDriverState *parent, BdrvChild
*child)
static void bdrv_parent_cb_change_media(BlockDriverState *bs, bool load)
{
BdrvChild *c;
+ assert(qemu_in_main_thread());
QLIST_FOREACH(c, &bs->parents, next_parent) {
if (c->klass->change_media) {
c->klass->change_media(c, load);
@@ -3792,6 +3797,7 @@ static BlockDriverState *bdrv_open_inherit(const char
*filename,
assert(!child_class || !flags);
assert(!child_class == !parent);
+ assert(qemu_in_main_thread());
if (reference) {
bool options_non_empty = options ? qdict_size(options) : false;
@@ -4178,6 +4184,7 @@ static BlockReopenQueue
*bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
* important to avoid graph changes between the recursive queuing here and
* bdrv_reopen_multiple(). */
assert(bs->quiesce_counter > 0);
+ assert(qemu_in_main_thread());
if (bs_queue == NULL) {
bs_queue = g_new0(BlockReopenQueue, 1);
@@ -7271,6 +7278,7 @@ void bdrv_set_aio_context_ignore(BlockDriverState *bs,
BdrvChild *child, *parent;
g_assert(qemu_get_current_aio_context() == qemu_get_aio_context());
+ assert(qemu_in_main_thread());
if (old_context == new_context) {
return;
@@ -7343,6 +7351,7 @@ void bdrv_set_aio_context_ignore(BlockDriverState *bs,
static bool bdrv_parent_can_set_aio_context(BdrvChild *c, AioContext *ctx,
GSList **ignore, Error **errp)
{
+ assert(qemu_in_main_thread());
if (g_slist_find(*ignore, c)) {
return true;
}
--
2.27.0
- [PATCH v5 11/31] include/block/blockjob_int.h: split header into I/O and GS API, (continued)
- [PATCH v5 11/31] include/block/blockjob_int.h: split header into I/O and GS API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 12/31] assertions for blockjob_int.h, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 14/31] include/block/blockjob.h: global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 15/31] assertions for blockjob.h global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 16/31] include/sysemu/blockdev.h: global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 20/31] block/coroutines: I/O API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 18/31] include/block/snapshot: global state API + assertions, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 17/31] assertions for blockdev.h global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 19/31] block/copy-before-write.h: global state API + assertions, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 22/31] block_int-common.h: assertion in the callers of BlockDriver function pointers, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 24/31] block_int-common.h: assertions in the callers of BdrvChildClass function pointers,
Emanuele Giuseppe Esposito <=
- [PATCH v5 21/31] block_int-common.h: split function pointers in BlockDriver, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 23/31] block_int-common.h: split function pointers in BdrvChildClass, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 26/31] job.h: split function pointers in JobDriver, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 25/31] block-backend-common.h: split function pointers in BlockDevOps, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 29/31] jobs: introduce pre_run function in JobDriver, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 27/31] job.h: assertions in the callers of JobDriver funcion pointers, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 30/31] crypto: delegate permission functions to JobDriver .pre_run, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 31/31] block.c: assertions to the block layer permissions API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 28/31] block.c: assert BQL lock held in bdrv_co_invalidate_cache, Emanuele Giuseppe Esposito, 2021/11/24
- Re: [PATCH v5 00/31] block layer: split block APIs in global state and I/O, Stefan Hajnoczi, 2021/11/29