aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-bitmap.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-06-01 13:51:43 +0200
committerKevin Wolf <kwolf@redhat.com>2023-06-28 09:46:32 +0200
commit70bacc44532f6324473b8d701705cd003e2fe678 (patch)
treebe227fb2a06c627a4f8683002960e3752d1a8b88 /block/qcow2-bitmap.c
parentf6b08994934f89866b510d335c6273bf998e857b (diff)
downloadqemu-70bacc44532f6324473b8d701705cd003e2fe678.zip
qemu-70bacc44532f6324473b8d701705cd003e2fe678.tar.gz
qemu-70bacc44532f6324473b8d701705cd003e2fe678.tar.bz2
qcow2: mark more functions as coroutine_fns and GRAPH_RDLOCK
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-ID: <20230601115145.196465-11-pbonzini@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-bitmap.c')
-rw-r--r--block/qcow2-bitmap.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index a952fd5..037fa2d 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -283,10 +283,9 @@ static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
/* load_bitmap_data
* @bitmap_table entries must satisfy specification constraints.
* @bitmap must be cleared */
-static int load_bitmap_data(BlockDriverState *bs,
- const uint64_t *bitmap_table,
- uint32_t bitmap_table_size,
- BdrvDirtyBitmap *bitmap)
+static int coroutine_fn GRAPH_RDLOCK
+load_bitmap_data(BlockDriverState *bs, const uint64_t *bitmap_table,
+ uint32_t bitmap_table_size, BdrvDirtyBitmap *bitmap)
{
int ret = 0;
BDRVQcow2State *s = bs->opaque;
@@ -319,7 +318,7 @@ static int load_bitmap_data(BlockDriverState *bs,
* already cleared */
}
} else {
- ret = bdrv_pread(bs->file, data_offset, s->cluster_size, buf, 0);
+ ret = bdrv_co_pread(bs->file, data_offset, s->cluster_size, buf, 0);
if (ret < 0) {
goto finish;
}
@@ -337,8 +336,9 @@ finish:
return ret;
}
-static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs,
- Qcow2Bitmap *bm, Error **errp)
+static coroutine_fn GRAPH_RDLOCK
+BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs,
+ Qcow2Bitmap *bm, Error **errp)
{
int ret;
uint64_t *bitmap_table = NULL;
@@ -649,9 +649,10 @@ fail:
return NULL;
}
-int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
- void **refcount_table,
- int64_t *refcount_table_size)
+int coroutine_fn
+qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
+ void **refcount_table,
+ int64_t *refcount_table_size)
{
int ret;
BDRVQcow2State *s = bs->opaque;
@@ -957,8 +958,9 @@ static void set_readonly_helper(gpointer bitmap, gpointer value)
* If header_updated is not NULL then it is set appropriately regardless of
* the return value.
*/
-bool coroutine_fn qcow2_load_dirty_bitmaps(BlockDriverState *bs,
- bool *header_updated, Error **errp)
+bool coroutine_fn GRAPH_RDLOCK
+qcow2_load_dirty_bitmaps(BlockDriverState *bs,
+ bool *header_updated, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
Qcow2BitmapList *bm_list;