[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 17/25] block/copy-before-write.h: global state API + assertion
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v3 17/25] block/copy-before-write.h: global state API + assertions |
Date: |
Tue, 12 Oct 2021 04:48:58 -0400 |
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>
---
block/copy-before-write.c | 2 ++
block/copy-before-write.h | 7 +++++++
2 files changed, 9 insertions(+)
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);
}
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,
--
2.27.0
- [PATCH v3 11/25] include/block/blockjob.h: global state API, (continued)
- [PATCH v3 11/25] include/block/blockjob.h: global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 13/25] include/sysemu/blockdev.h: move drive_add and inline drive_def, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 12/25] assertions for blockob.h global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 21/25] block_int-common.h: split function pointers in BdrvChildClass, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 14/25] include/systemu/blockdev.h: global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 19/25] block_int-common.h: split function pointers in BlockDriver, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 17/25] block/copy-before-write.h: global state API + assertions,
Emanuele Giuseppe Esposito <=
- [PATCH v3 15/25] assertions for blockdev.h global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 16/25] include/block/snapshot: global state API + assertions, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 20/25] block_int-common.h: assertion in the callers of BlockDriver function pointers, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 18/25] block/coroutines: I/O API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 22/25] block_int-common.h: assertions in the callers of BdrvChildClass function pointers, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 23/25] block-backend-common.h: split function pointers in BlockDevOps, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 24/25] job.h: split function pointers in JobDriver, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 25/25] job.h: assertions in the callers of JobDriver funcion pointers, Emanuele Giuseppe Esposito, 2021/10/12