aboutsummaryrefslogtreecommitdiff
path: root/block/qapi.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-12-05 13:20:03 -0500
committerKevin Wolf <kwolf@redhat.com>2023-12-21 22:49:27 +0100
commitb49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c (patch)
tree42f28762584421da298ba15cb21d027e002476bd /block/qapi.c
parent6bc30f19498547fac9cef98316a65cf6c1f14205 (diff)
downloadqemu-b49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c.zip
qemu-b49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c.tar.gz
qemu-b49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c.tar.bz2
block: remove AioContext locking
This is the big patch that removes aio_context_acquire()/aio_context_release() from the block layer and affected block layer users. There isn't a clean way to split this patch and the reviewers are likely the same group of people, so I decided to do it in one patch. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paul Durrant <paul@xen.org> Message-ID: <20231205182011.1976568-7-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r--block/qapi.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/block/qapi.c b/block/qapi.c
index 82a30b3..9e806fa 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -234,13 +234,11 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
int ret;
Error *err = NULL;
- aio_context_acquire(bdrv_get_aio_context(bs));
-
size = bdrv_getlength(bs);
if (size < 0) {
error_setg_errno(errp, -size, "Can't get image size '%s'",
bs->exact_filename);
- goto out;
+ return;
}
bdrv_refresh_filename(bs);
@@ -265,7 +263,7 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
info->format_specific = bdrv_get_specific_info(bs, &err);
if (err) {
error_propagate(errp, err);
- goto out;
+ return;
}
backing_filename = bs->backing_file;
if (backing_filename[0] != '\0') {
@@ -300,11 +298,8 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
break;
default:
error_propagate(errp, err);
- goto out;
+ return;
}
-
-out:
- aio_context_release(bdrv_get_aio_context(bs));
}
/**
@@ -709,15 +704,10 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
/* Just to be safe if query_nodes is not always initialized */
if (has_query_nodes && query_nodes) {
for (bs = bdrv_next_node(NULL); bs; bs = bdrv_next_node(bs)) {
- AioContext *ctx = bdrv_get_aio_context(bs);
-
- aio_context_acquire(ctx);
QAPI_LIST_APPEND(tail, bdrv_query_bds_stats(bs, false));
- aio_context_release(ctx);
}
} else {
for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
- AioContext *ctx = blk_get_aio_context(blk);
BlockStats *s;
char *qdev;
@@ -725,7 +715,6 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
continue;
}
- aio_context_acquire(ctx);
s = bdrv_query_bds_stats(blk_bs(blk), true);
s->device = g_strdup(blk_name(blk));
@@ -737,7 +726,6 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
}
bdrv_query_blk_stats(s->stats, blk);
- aio_context_release(ctx);
QAPI_LIST_APPEND(tail, s);
}