[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/18] Mark assert_bdrv_graph_readable/writable() GRAPH_RD/WRLOCK
From: |
Kevin Wolf |
Subject: |
[PATCH 15/18] Mark assert_bdrv_graph_readable/writable() GRAPH_RD/WRLOCK |
Date: |
Wed, 7 Dec 2022 14:18:35 +0100 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block_int-common.h | 4 ++--
include/block/graph-lock.h | 4 ++--
block.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index a6bc6b7fe9..b1f0d88307 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -898,8 +898,8 @@ struct BdrvChildClass {
void (*activate)(BdrvChild *child, Error **errp);
int (*inactivate)(BdrvChild *child);
- void (*attach)(BdrvChild *child);
- void (*detach)(BdrvChild *child);
+ void GRAPH_WRLOCK_PTR (*attach)(BdrvChild *child);
+ void GRAPH_WRLOCK_PTR (*detach)(BdrvChild *child);
/*
* Notifies the parent that the filename of its child has changed (e.g.
diff --git a/include/block/graph-lock.h b/include/block/graph-lock.h
index 50b7e7b1b6..0c66386167 100644
--- a/include/block/graph-lock.h
+++ b/include/block/graph-lock.h
@@ -176,14 +176,14 @@ bdrv_graph_rdunlock_main_loop(void);
* or there is at least a reader helding the rdlock.
* In this way an incoming writer is aware of the read and waits.
*/
-void assert_bdrv_graph_readable(void);
+void GRAPH_RDLOCK assert_bdrv_graph_readable(void);
/*
* assert_bdrv_graph_writable:
* Make sure that the writer is the main loop and has set @has_writer,
* so that incoming readers will pause.
*/
-void assert_bdrv_graph_writable(void);
+void GRAPH_WRLOCK assert_bdrv_graph_writable(void);
/*
* Calling this function tells TSA that we know that the lock is effectively
diff --git a/block.c b/block.c
index ff53b41af3..1a82fd101a 100644
--- a/block.c
+++ b/block.c
@@ -1402,7 +1402,7 @@ static void bdrv_inherited_options(BdrvChildRole role,
bool parent_is_format,
*child_flags = flags;
}
-static void bdrv_child_cb_attach(BdrvChild *child)
+static void GRAPH_WRLOCK bdrv_child_cb_attach(BdrvChild *child)
{
BlockDriverState *bs = child->opaque;
@@ -1444,7 +1444,7 @@ static void bdrv_child_cb_attach(BdrvChild *child)
}
}
-static void bdrv_child_cb_detach(BdrvChild *child)
+static void GRAPH_WRLOCK bdrv_child_cb_detach(BdrvChild *child)
{
BlockDriverState *bs = child->opaque;
--
2.38.1
- [PATCH 05/18] Import clang-tsa.h, (continued)
- [PATCH 05/18] Import clang-tsa.h, Kevin Wolf, 2022/12/07
- [PATCH 07/18] clang-tsa: Add macros for shared locks, Kevin Wolf, 2022/12/07
- [PATCH 08/18] configure: Enable -Wthread-safety if present, Kevin Wolf, 2022/12/07
- [PATCH 10/18] block: Fix locking in external_snapshot_prepare(), Kevin Wolf, 2022/12/07
- [PATCH 12/18] block: remove unnecessary assert_bdrv_graph_writable(), Kevin Wolf, 2022/12/07
- [PATCH 11/18] block: wrlock in bdrv_replace_child_noperm, Kevin Wolf, 2022/12/07
- [PATCH 06/18] clang-tsa: Add TSA_ASSERT() macro, Kevin Wolf, 2022/12/07
- [PATCH 14/18] graph-lock: TSA annotations for lock/unlock functions, Kevin Wolf, 2022/12/07
- [PATCH 13/18] block: assert that graph read and writes are performed correctly, Kevin Wolf, 2022/12/07
- [PATCH 16/18] block-coroutine-wrapper.py: introduce annotations that take the graph rdlock, Kevin Wolf, 2022/12/07
- [PATCH 15/18] Mark assert_bdrv_graph_readable/writable() GRAPH_RD/WRLOCK,
Kevin Wolf <=
- [PATCH 17/18] block: use co_wrapper_mixed_bdrv_rdlock in functions taking the rdlock, Kevin Wolf, 2022/12/07
- [PATCH 18/18] block: GRAPH_RDLOCK for functions only called by co_wrappers, Kevin Wolf, 2022/12/07
- [PATCH 09/18] test-bdrv-drain: Fix incorrrect drain assumptions, Kevin Wolf, 2022/12/07
- Re: [PATCH 00/18] block: Introduce a block graph rwlock, Emanuele Giuseppe Esposito, 2022/12/07