block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_*_dirty_bitmap() need to hold a reader lock for the graph. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230203152202.49054-23-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
48aef79440
commit
167f748d8c
@ -394,6 +394,7 @@ int coroutine_fn
|
|||||||
bdrv_co_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
|
bdrv_co_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
if (bs->drv && bs->drv->bdrv_co_remove_persistent_dirty_bitmap) {
|
if (bs->drv && bs->drv->bdrv_co_remove_persistent_dirty_bitmap) {
|
||||||
return bs->drv->bdrv_co_remove_persistent_dirty_bitmap(bs, name, errp);
|
return bs->drv->bdrv_co_remove_persistent_dirty_bitmap(bs, name, errp);
|
||||||
}
|
}
|
||||||
@ -415,6 +416,7 @@ bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
|
|||||||
uint32_t granularity, Error **errp)
|
uint32_t granularity, Error **errp)
|
||||||
{
|
{
|
||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_setg_errno(errp, ENOMEDIUM,
|
error_setg_errno(errp, ENOMEDIUM,
|
||||||
|
@ -243,14 +243,12 @@ AioContext *child_of_bds_get_parent_aio_context(BdrvChild *c);
|
|||||||
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_plug(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_plug(BlockDriverState *bs);
|
||||||
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_unplug(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_unplug(BlockDriverState *bs);
|
||||||
|
|
||||||
bool coroutine_fn bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
bool coroutine_fn GRAPH_RDLOCK
|
||||||
const char *name,
|
bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||||
uint32_t granularity,
|
uint32_t granularity, Error **errp);
|
||||||
Error **errp);
|
bool co_wrapper_bdrv_rdlock
|
||||||
bool co_wrapper bdrv_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
bdrv_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||||
const char *name,
|
uint32_t granularity, Error **errp);
|
||||||
uint32_t granularity,
|
|
||||||
Error **errp);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -759,10 +759,12 @@ struct BlockDriver {
|
|||||||
void (*bdrv_drain_end)(BlockDriverState *bs);
|
void (*bdrv_drain_end)(BlockDriverState *bs);
|
||||||
|
|
||||||
bool (*bdrv_supports_persistent_dirty_bitmap)(BlockDriverState *bs);
|
bool (*bdrv_supports_persistent_dirty_bitmap)(BlockDriverState *bs);
|
||||||
bool coroutine_fn (*bdrv_co_can_store_new_dirty_bitmap)(
|
|
||||||
|
bool coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_can_store_new_dirty_bitmap)(
|
||||||
BlockDriverState *bs, const char *name, uint32_t granularity,
|
BlockDriverState *bs, const char *name, uint32_t granularity,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
int coroutine_fn (*bdrv_co_remove_persistent_dirty_bitmap)(
|
|
||||||
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_remove_persistent_dirty_bitmap)(
|
||||||
BlockDriverState *bs, const char *name, Error **errp);
|
BlockDriverState *bs, const char *name, Error **errp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ int bdrv_dirty_bitmap_check(const BdrvDirtyBitmap *bitmap, uint32_t flags,
|
|||||||
void bdrv_release_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
void bdrv_release_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
||||||
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs);
|
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs);
|
||||||
|
|
||||||
int coroutine_fn bdrv_co_remove_persistent_dirty_bitmap(BlockDriverState *bs,
|
int coroutine_fn GRAPH_RDLOCK
|
||||||
const char *name,
|
bdrv_co_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
int co_wrapper bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
|
int co_wrapper_bdrv_rdlock
|
||||||
const char *name,
|
bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
||||||
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
||||||
|
Loading…
Reference in New Issue
Block a user