aboutsummaryrefslogtreecommitdiff
path: root/block/gluster.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2023-01-13 21:42:07 +0100
committerKevin Wolf <kwolf@redhat.com>2023-02-01 16:52:32 +0100
commit82618d7bc341cb93b9ce9c206d7ec84cebe83d00 (patch)
tree6975780788282725aee83e4ced9de182e9c7bf46 /block/gluster.c
parentbd53086e824397a7bf0e875eaa9b339cf8394d75 (diff)
block: Convert bdrv_get_allocated_file_size() to co_wrapper
bdrv_get_allocated_file_size() is categorized as an I/O function, and it currently doesn't run in a coroutine. We should let it take a graph rdlock since it traverses the block nodes graph, which however is only possible in a coroutine. Therefore turn it into a co_wrapper to move the actual function into a coroutine where the lock can be taken. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230113204212.359076-10-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/gluster.c')
-rw-r--r--block/gluster.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/block/gluster.c b/block/gluster.c
index 0b325e4292..185a83e5e5 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -1331,7 +1331,8 @@ static int64_t coroutine_fn qemu_gluster_co_getlength(BlockDriverState *bs)
}
}
-static int64_t qemu_gluster_allocated_file_size(BlockDriverState *bs)
+static int64_t coroutine_fn
+qemu_gluster_co_get_allocated_file_size(BlockDriverState *bs)
{
BDRVGlusterState *s = bs->opaque;
struct stat st;
@@ -1560,7 +1561,7 @@ static BlockDriver bdrv_gluster = {
.bdrv_co_create = qemu_gluster_co_create,
.bdrv_co_create_opts = qemu_gluster_co_create_opts,
.bdrv_co_getlength = qemu_gluster_co_getlength,
- .bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
+ .bdrv_co_get_allocated_file_size = qemu_gluster_co_get_allocated_file_size,
.bdrv_co_truncate = qemu_gluster_co_truncate,
.bdrv_co_readv = qemu_gluster_co_readv,
.bdrv_co_writev = qemu_gluster_co_writev,
@@ -1589,7 +1590,7 @@ static BlockDriver bdrv_gluster_tcp = {
.bdrv_co_create = qemu_gluster_co_create,
.bdrv_co_create_opts = qemu_gluster_co_create_opts,
.bdrv_co_getlength = qemu_gluster_co_getlength,
- .bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
+ .bdrv_co_get_allocated_file_size = qemu_gluster_co_get_allocated_file_size,
.bdrv_co_truncate = qemu_gluster_co_truncate,
.bdrv_co_readv = qemu_gluster_co_readv,
.bdrv_co_writev = qemu_gluster_co_writev,
@@ -1618,7 +1619,7 @@ static BlockDriver bdrv_gluster_unix = {
.bdrv_co_create = qemu_gluster_co_create,
.bdrv_co_create_opts = qemu_gluster_co_create_opts,
.bdrv_co_getlength = qemu_gluster_co_getlength,
- .bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
+ .bdrv_co_get_allocated_file_size = qemu_gluster_co_get_allocated_file_size,
.bdrv_co_truncate = qemu_gluster_co_truncate,
.bdrv_co_readv = qemu_gluster_co_readv,
.bdrv_co_writev = qemu_gluster_co_writev,
@@ -1653,7 +1654,7 @@ static BlockDriver bdrv_gluster_rdma = {
.bdrv_co_create = qemu_gluster_co_create,
.bdrv_co_create_opts = qemu_gluster_co_create_opts,
.bdrv_co_getlength = qemu_gluster_co_getlength,
- .bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
+ .bdrv_co_get_allocated_file_size = qemu_gluster_co_get_allocated_file_size,
.bdrv_co_truncate = qemu_gluster_co_truncate,
.bdrv_co_readv = qemu_gluster_co_readv,
.bdrv_co_writev = qemu_gluster_co_writev,