block: Mark bdrv_get_specific_info() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_get_specific_info() need to hold a reader lock for the graph. This removes an assume_graph_lock() call in vmdk's implementation. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-20-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
018f9dea9c
commit
3574499a1e
@ -2990,16 +2990,14 @@ vmdk_co_check(BlockDriverState *bs, BdrvCheckResult *result, BdrvCheckMode fix)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs,
|
static ImageInfoSpecific * GRAPH_RDLOCK
|
||||||
Error **errp)
|
vmdk_get_specific_info(BlockDriverState *bs, Error **errp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
BDRVVmdkState *s = bs->opaque;
|
BDRVVmdkState *s = bs->opaque;
|
||||||
ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1);
|
ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1);
|
||||||
VmdkExtentInfoList **tail;
|
VmdkExtentInfoList **tail;
|
||||||
|
|
||||||
assume_graph_lock(); /* FIXME */
|
|
||||||
|
|
||||||
*spec_info = (ImageInfoSpecific){
|
*spec_info = (ImageInfoSpecific){
|
||||||
.type = IMAGE_INFO_SPECIFIC_KIND_VMDK,
|
.type = IMAGE_INFO_SPECIFIC_KIND_VMDK,
|
||||||
.u = {
|
.u = {
|
||||||
|
@ -198,8 +198,9 @@ bdrv_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
|
|||||||
int co_wrapper_mixed_bdrv_rdlock
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
|
bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
|
||||||
|
|
||||||
ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs,
|
ImageInfoSpecific * GRAPH_RDLOCK
|
||||||
Error **errp);
|
bdrv_get_specific_info(BlockDriverState *bs, Error **errp);
|
||||||
|
|
||||||
BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs);
|
BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs);
|
||||||
void bdrv_round_to_subclusters(BlockDriverState *bs,
|
void bdrv_round_to_subclusters(BlockDriverState *bs,
|
||||||
int64_t offset, int64_t bytes,
|
int64_t offset, int64_t bytes,
|
||||||
|
@ -728,8 +728,8 @@ struct BlockDriver {
|
|||||||
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_get_info)(
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_get_info)(
|
||||||
BlockDriverState *bs, BlockDriverInfo *bdi);
|
BlockDriverState *bs, BlockDriverInfo *bdi);
|
||||||
|
|
||||||
ImageInfoSpecific *(*bdrv_get_specific_info)(BlockDriverState *bs,
|
ImageInfoSpecific * GRAPH_RDLOCK_PTR (*bdrv_get_specific_info)(
|
||||||
Error **errp);
|
BlockDriverState *bs, Error **errp);
|
||||||
BlockStatsSpecific *(*bdrv_get_specific_stats)(BlockDriverState *bs);
|
BlockStatsSpecific *(*bdrv_get_specific_stats)(BlockDriverState *bs);
|
||||||
|
|
||||||
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_save_vmstate)(
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_save_vmstate)(
|
||||||
|
@ -2037,6 +2037,9 @@ static int info_f(BlockBackend *blk, int argc, char **argv)
|
|||||||
char s1[64], s2[64];
|
char s1[64], s2[64];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
GLOBAL_STATE_CODE();
|
||||||
|
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||||
|
|
||||||
if (bs->drv && bs->drv->format_name) {
|
if (bs->drv && bs->drv->format_name) {
|
||||||
printf("format name: %s\n", bs->drv->format_name);
|
printf("format name: %s\n", bs->drv->format_name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user