This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it is in preparatoin to move the drain out of bdrv_change_aio_context() and marking that function as GRAPH_RDLOCK.
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- New in v2. Checkpatch seems to report a false positive here, but it's the same for other callbacks in that header file: ERROR: space prohibited between function name and open parenthesis '(' #86: FILE: include/block/block_int-common.h:986: + bool GRAPH_RDLOCK_PTR (*change_aio_ctx)(BdrvChild *child, AioContext *ctx, block.c | 7 ++++--- block/block-backend.c | 6 +++--- blockjob.c | 6 +++--- include/block/block_int-common.h | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 7207978e53..01144c895e 100644 --- a/block.c +++ b/block.c @@ -1226,9 +1226,10 @@ static int bdrv_child_cb_inactivate(BdrvChild *child) return 0; } -static bool bdrv_child_cb_change_aio_ctx(BdrvChild *child, AioContext *ctx, - GHashTable *visited, Transaction *tran, - Error **errp) +static bool GRAPH_RDLOCK +bdrv_child_cb_change_aio_ctx(BdrvChild *child, AioContext *ctx, + GHashTable *visited, Transaction *tran, + Error **errp) { BlockDriverState *bs = child->opaque; return bdrv_change_aio_context(bs, ctx, visited, tran, errp); diff --git a/block/block-backend.c b/block/block-backend.c index a402db13f2..6a6949edeb 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -136,9 +136,9 @@ static void blk_root_drained_end(BdrvChild *child); static void blk_root_change_media(BdrvChild *child, bool load); static void blk_root_resize(BdrvChild *child); -static bool blk_root_change_aio_ctx(BdrvChild *child, AioContext *ctx, - GHashTable *visited, Transaction *tran, - Error **errp); +static bool GRAPH_RDLOCK +blk_root_change_aio_ctx(BdrvChild *child, AioContext *ctx, GHashTable *visited, + Transaction *tran, Error **errp); static char *blk_root_get_parent_desc(BdrvChild *child) { diff --git a/blockjob.c b/blockjob.c index 32007f31a9..34185d7715 100644 --- a/blockjob.c +++ b/blockjob.c @@ -144,9 +144,9 @@ static TransactionActionDrv change_child_job_context = { .clean = g_free, }; -static bool child_job_change_aio_ctx(BdrvChild *c, AioContext *ctx, - GHashTable *visited, Transaction *tran, - Error **errp) +static bool GRAPH_RDLOCK +child_job_change_aio_ctx(BdrvChild *c, AioContext *ctx, GHashTable *visited, + Transaction *tran, Error **errp) { BlockJob *job = c->opaque; BdrvStateChildJobContext *s; diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index 2982dd3118..37466c7841 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -983,9 +983,9 @@ struct BdrvChildClass { bool backing_mask_protocol, Error **errp); - bool (*change_aio_ctx)(BdrvChild *child, AioContext *ctx, - GHashTable *visited, Transaction *tran, - Error **errp); + bool GRAPH_RDLOCK_PTR (*change_aio_ctx)(BdrvChild *child, AioContext *ctx, + GHashTable *visited, + Transaction *tran, Error **errp); /* * I/O API functions. These functions are thread-safe. -- 2.39.5