block: mark change_aio_ctx() callback and instances as GRAPH_RDLOCK(_PTR)

This is a small step in preparation to mark bdrv_drained_begin() as
GRAPH_UNLOCKED. More concretely, it is in preparation to move the
drain out of bdrv_change_aio_context() and marking that function as
GRAPH_RDLOCK.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250530151125.955508-7-f.ebner@proxmox.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Fiona Ebner 2025-05-30 17:10:43 +02:00 committed by Kevin Wolf
parent 3758733959
commit 844d550d09
4 changed files with 13 additions and 12 deletions

View file

@ -1226,9 +1226,10 @@ static int bdrv_child_cb_inactivate(BdrvChild *child)
return 0; return 0;
} }
static bool bdrv_child_cb_change_aio_ctx(BdrvChild *child, AioContext *ctx, static bool GRAPH_RDLOCK
GHashTable *visited, Transaction *tran, bdrv_child_cb_change_aio_ctx(BdrvChild *child, AioContext *ctx,
Error **errp) GHashTable *visited, Transaction *tran,
Error **errp)
{ {
BlockDriverState *bs = child->opaque; BlockDriverState *bs = child->opaque;
return bdrv_change_aio_context(bs, ctx, visited, tran, errp); return bdrv_change_aio_context(bs, ctx, visited, tran, errp);

View file

@ -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_change_media(BdrvChild *child, bool load);
static void blk_root_resize(BdrvChild *child); static void blk_root_resize(BdrvChild *child);
static bool blk_root_change_aio_ctx(BdrvChild *child, AioContext *ctx, static bool GRAPH_RDLOCK
GHashTable *visited, Transaction *tran, blk_root_change_aio_ctx(BdrvChild *child, AioContext *ctx, GHashTable *visited,
Error **errp); Transaction *tran, Error **errp);
static char *blk_root_get_parent_desc(BdrvChild *child) static char *blk_root_get_parent_desc(BdrvChild *child)
{ {

View file

@ -144,9 +144,9 @@ static TransactionActionDrv change_child_job_context = {
.clean = g_free, .clean = g_free,
}; };
static bool child_job_change_aio_ctx(BdrvChild *c, AioContext *ctx, static bool GRAPH_RDLOCK
GHashTable *visited, Transaction *tran, child_job_change_aio_ctx(BdrvChild *c, AioContext *ctx, GHashTable *visited,
Error **errp) Transaction *tran, Error **errp)
{ {
BlockJob *job = c->opaque; BlockJob *job = c->opaque;
BdrvStateChildJobContext *s; BdrvStateChildJobContext *s;

View file

@ -983,9 +983,9 @@ struct BdrvChildClass {
bool backing_mask_protocol, bool backing_mask_protocol,
Error **errp); Error **errp);
bool (*change_aio_ctx)(BdrvChild *child, AioContext *ctx, bool GRAPH_RDLOCK_PTR (*change_aio_ctx)(BdrvChild *child, AioContext *ctx,
GHashTable *visited, Transaction *tran, GHashTable *visited,
Error **errp); Transaction *tran, Error **errp);
/* /*
* I/O API functions. These functions are thread-safe. * I/O API functions. These functions are thread-safe.