[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 16/25] block/backup-top.h: global state API + assertions
From: |
Emanuele Giuseppe Esposito |
Subject: |
[RFC PATCH v2 16/25] block/backup-top.h: global state API + assertions |
Date: |
Tue, 5 Oct 2021 10:32:06 -0400 |
backup-top functions always run under BQL lock.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/backup-top.c | 2 ++
block/backup-top.h | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/block/backup-top.c b/block/backup-top.c
index 425e3778be..8b58a909f7 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -182,6 +182,7 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState
*source,
bool appended = false;
assert(source->total_sectors == target->total_sectors);
+ g_assert(qemu_in_main_thread());
top = bdrv_new_open_driver(&bdrv_backup_top_filter, filter_node_name,
BDRV_O_RDWR, errp);
@@ -244,6 +245,7 @@ fail:
void bdrv_backup_top_drop(BlockDriverState *bs)
{
BDRVBackupTopState *s = bs->opaque;
+ g_assert(qemu_in_main_thread());
bdrv_drop_filter(bs, &error_abort);
diff --git a/block/backup-top.h b/block/backup-top.h
index b28b0031c4..8cb6f62869 100644
--- a/block/backup-top.h
+++ b/block/backup-top.h
@@ -29,6 +29,17 @@
#include "block/block_int.h"
#include "block/block-copy.h"
+/*
+ * Graph API. These functions run under the BQL lock.
+ *
+ * If a function modifies the graph, it uses drain and/or
+ * aio_context_acquire/release to be sure it has unique access.
+ *
+ * All functions in this header must use this assertion:
+ * g_assert(qemu_in_main_thread());
+ * to be sure they belong here.
+ */
+
BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
BlockDriverState *target,
const char *filter_node_name,
--
2.27.0
- [RFC PATCH v2 13/25] include/systemu/blockdev.h: global state API, (continued)
- [RFC PATCH v2 14/25] assertions for blockdev.h global state API, Emanuele Giuseppe Esposito, 2021/10/05
- [RFC PATCH v2 16/25] block/backup-top.h: global state API + assertions,
Emanuele Giuseppe Esposito <=
- [RFC PATCH v2 18/25] block/coroutines: I/O API, Emanuele Giuseppe Esposito, 2021/10/05
- [RFC PATCH v2 17/25] include/block/transactions: global state API + assertions, Emanuele Giuseppe Esposito, 2021/10/05
- [RFC PATCH v2 15/25] include/block/snapshot: global state API + assertions, Emanuele Giuseppe Esposito, 2021/10/05