Skip to content

Commit

Permalink
Mark assert_bdrv_graph_readable/writable() GRAPH_RD/WRLOCK
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20221207131838.239125-16-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed Dec 15, 2022
1 parent 4002ffd commit 303de47
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions block.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions include/block/block_int-common.h
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions include/block/graph-lock.h
Expand Up @@ -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
Expand Down

0 comments on commit 303de47

Please sign in to comment.