[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 19/31] block/copy-before-write.h: global state API + assertion
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v5 19/31] block/copy-before-write.h: global state API + assertions |
Date: |
Wed, 24 Nov 2021 01:44:06 -0500 |
copy-before-write functions always run under BQL lock.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/copy-before-write.h | 7 +++++++
block/copy-before-write.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/block/copy-before-write.h b/block/copy-before-write.h
index 51847e711a..9a45de2fce 100644
--- a/block/copy-before-write.h
+++ b/block/copy-before-write.h
@@ -29,6 +29,13 @@
#include "block/block_int.h"
#include "block/block-copy.h"
+/*
+ * Global state (GS) API. These functions run under the BQL lock.
+ *
+ * See include/block/block-global-state.h for more information about
+ * the GS API.
+ */
+
BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
BlockDriverState *target,
const char *filter_node_name,
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index c30a5ff8de..36a8d7ba52 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -223,6 +223,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
QDict *opts;
assert(source->total_sectors == target->total_sectors);
+ assert(qemu_in_main_thread());
opts = qdict_new();
qdict_put_str(opts, "driver", "copy-before-write");
@@ -245,6 +246,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
void bdrv_cbw_drop(BlockDriverState *bs)
{
+ assert(qemu_in_main_thread());
bdrv_drop_filter(bs, &error_abort);
bdrv_unref(bs);
}
--
2.27.0
- [PATCH v5 10/31] block.c: modify .attach and .detach callbacks of child_of_bds, (continued)
- [PATCH v5 10/31] block.c: modify .attach and .detach callbacks of child_of_bds, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 08/31] assertions for block_int global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 09/31] block: introduce assert_bdrv_graph_writable, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 07/31] include/block/block_int: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 12/31] assertions for blockjob_int.h, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 13/31] block.c: add assertions to static functions, Emanuele Giuseppe Esposito, 2021/11/24
- [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 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 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 <=
- [PATCH v5 16/31] include/sysemu/blockdev.h: global state 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 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, 2021/11/24
- [PATCH v5 23/31] block_int-common.h: split function pointers in BdrvChildClass, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 20/31] block/coroutines: I/O API, 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 21/31] block_int-common.h: split function pointers in BlockDriver, 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 27/31] job.h: assertions in the callers of JobDriver funcion pointers, Emanuele Giuseppe Esposito, 2021/11/24