[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 21/31] assertions for blockdev.h global state API
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v7 21/31] assertions for blockdev.h global state API |
Date: |
Fri, 11 Feb 2022 09:51:43 -0500 |
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/block-backend.c | 3 +++
blockdev.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index e5708702db..d8a77a5832 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -810,6 +810,7 @@ bool bdrv_is_root_node(BlockDriverState *bs)
*/
DriveInfo *blk_legacy_dinfo(BlockBackend *blk)
{
+ GLOBAL_STATE_CODE();
return blk->legacy_dinfo;
}
@@ -821,6 +822,7 @@ DriveInfo *blk_legacy_dinfo(BlockBackend *blk)
DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo)
{
assert(!blk->legacy_dinfo);
+ GLOBAL_STATE_CODE();
return blk->legacy_dinfo = dinfo;
}
@@ -831,6 +833,7 @@ DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk,
DriveInfo *dinfo)
BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo)
{
BlockBackend *blk = NULL;
+ GLOBAL_STATE_CODE();
while ((blk = blk_next(blk)) != NULL) {
if (blk->legacy_dinfo == dinfo) {
diff --git a/blockdev.c b/blockdev.c
index 9e638f1982..ba20f5f1ab 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -113,6 +113,8 @@ void override_max_devs(BlockInterfaceType type, int
max_devs)
BlockBackend *blk;
DriveInfo *dinfo;
+ GLOBAL_STATE_CODE();
+
if (max_devs <= 0) {
return;
}
@@ -142,6 +144,8 @@ void blockdev_mark_auto_del(BlockBackend *blk)
DriveInfo *dinfo = blk_legacy_dinfo(blk);
BlockJob *job;
+ GLOBAL_STATE_CODE();
+
if (!dinfo) {
return;
}
@@ -163,6 +167,7 @@ void blockdev_mark_auto_del(BlockBackend *blk)
void blockdev_auto_del(BlockBackend *blk)
{
DriveInfo *dinfo = blk_legacy_dinfo(blk);
+ GLOBAL_STATE_CODE();
if (dinfo && dinfo->auto_del) {
monitor_remove_blk(blk);
@@ -187,6 +192,8 @@ QemuOpts *drive_add(BlockInterfaceType type, int index,
const char *file,
{
QemuOpts *opts;
+ GLOBAL_STATE_CODE();
+
opts = qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, false);
if (!opts) {
return NULL;
@@ -207,6 +214,8 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int
unit)
BlockBackend *blk;
DriveInfo *dinfo;
+ GLOBAL_STATE_CODE();
+
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
if (dinfo && dinfo->type == type
@@ -229,6 +238,8 @@ void drive_check_orphaned(void)
Location loc;
bool orphans = false;
+ GLOBAL_STATE_CODE();
+
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
/*
@@ -262,6 +273,7 @@ void drive_check_orphaned(void)
DriveInfo *drive_get_by_index(BlockInterfaceType type, int index)
{
+ GLOBAL_STATE_CODE();
return drive_get(type,
drive_index_to_bus_id(type, index),
drive_index_to_unit_id(type, index));
@@ -273,6 +285,8 @@ int drive_get_max_bus(BlockInterfaceType type)
BlockBackend *blk;
DriveInfo *dinfo;
+ GLOBAL_STATE_CODE();
+
max_bus = -1;
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
@@ -759,6 +773,8 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType
block_default_type,
const char *filename;
int i;
+ GLOBAL_STATE_CODE();
+
/* Change legacy command line options into QMP ones */
static const struct {
const char *from;
--
2.31.1
- [PATCH v7 08/31] block/block-backend.c: assertions for block-backend, (continued)
- [PATCH v7 08/31] block/block-backend.c: assertions for block-backend, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 09/31] IO_CODE and IO_OR_GS_CODE for block-backend I/O API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 19/31] assertions for blockjob.h global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 27/31] block_int-common.h: split function pointers in BdrvChildClass, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 06/31] block/export/fuse.c: allow writable exports to take RESIZE permission, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 28/31] block_int-common.h: assertions in the callers of BdrvChildClass function pointers, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 05/31] IO_CODE and IO_OR_GS_CODE for block I/O API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 07/31] include/sysemu/block-backend: split header into I/O and global state (GS) API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 16/31] GS and IO CODE macros for blockjob_int.h, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 03/31] include/block/block: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 21/31] assertions for blockdev.h global state API,
Emanuele Giuseppe Esposito <=
- [PATCH v7 24/31] block/coroutines: I/O and "I/O or GS" API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 23/31] block/copy-before-write.h: global state API + assertions, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 25/31] block_int-common.h: split function pointers in BlockDriver, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 26/31] block_int-common.h: assertions in the callers of BlockDriver function pointers, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 29/31] block-backend-common.h: split function pointers in BlockDevOps, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 31/31] job.h: assertions in the callers of JobDriver function pointers, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 30/31] job.h: split function pointers in JobDriver, Emanuele Giuseppe Esposito, 2022/02/11