aboutsummaryrefslogtreecommitdiff
path: root/block/nfs.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/nfs.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/nfs.c')
-rw-r--r--block/nfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/nfs.c b/block/nfs.c
index 5e288dfc83..351dc6ec8d 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -732,7 +732,7 @@ nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
bdrv_wakeup(task->bs);
}
-static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
+static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
{
NFSClient *client = bs->opaque;
NFSRPC task = {0};
@@ -885,7 +885,7 @@ static BlockDriver bdrv_nfs = {
.bdrv_has_zero_init = nfs_has_zero_init,
/* libnfs does not provide the allocated filesize of a file on win32. */
#if !defined(_WIN32)
- .bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
+ .bdrv_co_get_allocated_file_size = nfs_co_get_allocated_file_size,
#endif
.bdrv_co_truncate = nfs_file_co_truncate,