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>
This commit is contained in:
Paolo Bonzini 2023-06-01 13:51:43 +02:00 committed by Kevin Wolf
parent f6b0899493
commit 70bacc4453
5 changed files with 105 additions and 98 deletions

View File

@ -283,10 +283,9 @@ static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
/* load_bitmap_data /* load_bitmap_data
* @bitmap_table entries must satisfy specification constraints. * @bitmap_table entries must satisfy specification constraints.
* @bitmap must be cleared */ * @bitmap must be cleared */
static int load_bitmap_data(BlockDriverState *bs, static int coroutine_fn GRAPH_RDLOCK
const uint64_t *bitmap_table, load_bitmap_data(BlockDriverState *bs, const uint64_t *bitmap_table,
uint32_t bitmap_table_size, uint32_t bitmap_table_size, BdrvDirtyBitmap *bitmap)
BdrvDirtyBitmap *bitmap)
{ {
int ret = 0; int ret = 0;
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
@ -319,7 +318,7 @@ static int load_bitmap_data(BlockDriverState *bs,
* already cleared */ * already cleared */
} }
} else { } 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) { if (ret < 0) {
goto finish; goto finish;
} }
@ -337,7 +336,8 @@ finish:
return ret; return ret;
} }
static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs, static coroutine_fn GRAPH_RDLOCK
BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs,
Qcow2Bitmap *bm, Error **errp) Qcow2Bitmap *bm, Error **errp)
{ {
int ret; int ret;
@ -649,7 +649,8 @@ fail:
return NULL; return NULL;
} }
int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn
qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table,
int64_t *refcount_table_size) int64_t *refcount_table_size)
{ {
@ -957,7 +958,8 @@ static void set_readonly_helper(gpointer bitmap, gpointer value)
* If header_updated is not NULL then it is set appropriately regardless of * If header_updated is not NULL then it is set appropriately regardless of
* the return value. * the return value.
*/ */
bool coroutine_fn qcow2_load_dirty_bitmaps(BlockDriverState *bs, bool coroutine_fn GRAPH_RDLOCK
qcow2_load_dirty_bitmaps(BlockDriverState *bs,
bool *header_updated, Error **errp) bool *header_updated, Error **errp)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;

View File

@ -823,10 +823,9 @@ static int get_cluster_table(BlockDriverState *bs, uint64_t offset,
* *
* Return 0 on success and -errno in error cases * Return 0 on success and -errno in error cases
*/ */
int coroutine_fn qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, int coroutine_fn GRAPH_RDLOCK
uint64_t offset, qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, uint64_t offset,
int compressed_size, int compressed_size, uint64_t *host_offset)
uint64_t *host_offset)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
int l2_index, ret; int l2_index, ret;
@ -2038,7 +2037,8 @@ fail:
* all clusters in the same L2 slice) and returns the number of zeroed * all clusters in the same L2 slice) and returns the number of zeroed
* clusters. * clusters.
*/ */
static int zero_in_l2_slice(BlockDriverState *bs, uint64_t offset, static int coroutine_fn
zero_in_l2_slice(BlockDriverState *bs, uint64_t offset,
uint64_t nb_clusters, int flags) uint64_t nb_clusters, int flags)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;

View File

@ -1069,7 +1069,7 @@ int64_t coroutine_fn qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offs
/* only used to allocate compressed sectors. We try to allocate /* only used to allocate compressed sectors. We try to allocate
contiguous sectors. size must be <= cluster_size */ contiguous sectors. size must be <= cluster_size */
int64_t coroutine_fn qcow2_alloc_bytes(BlockDriverState *bs, int size) int64_t coroutine_fn GRAPH_RDLOCK qcow2_alloc_bytes(BlockDriverState *bs, int size)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
int64_t offset; int64_t offset;
@ -1524,7 +1524,8 @@ static int realloc_refcount_array(BDRVQcow2State *s, void **array,
* *
* Modifies the number of errors in res. * Modifies the number of errors in res.
*/ */
int qcow2_inc_refcounts_imrt(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn GRAPH_RDLOCK
qcow2_inc_refcounts_imrt(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table,
int64_t *refcount_table_size, int64_t *refcount_table_size,
int64_t offset, int64_t size) int64_t offset, int64_t size)
@ -1538,7 +1539,7 @@ int qcow2_inc_refcounts_imrt(BlockDriverState *bs, BdrvCheckResult *res,
return 0; return 0;
} }
file_len = bdrv_getlength(bs->file->bs); file_len = bdrv_co_getlength(bs->file->bs);
if (file_len < 0) { if (file_len < 0) {
return file_len; return file_len;
} }
@ -1600,9 +1601,10 @@ enum {
* *
* On failure in-memory @l2_table may be modified. * On failure in-memory @l2_table may be modified.
*/ */
static int fix_l2_entry_by_zero(BlockDriverState *bs, BdrvCheckResult *res, static int coroutine_fn GRAPH_RDLOCK
uint64_t l2_offset, fix_l2_entry_by_zero(BlockDriverState *bs, BdrvCheckResult *res,
uint64_t *l2_table, int l2_index, bool active, uint64_t l2_offset, uint64_t *l2_table,
int l2_index, bool active,
bool *metadata_overlap) bool *metadata_overlap)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
@ -1634,7 +1636,7 @@ static int fix_l2_entry_by_zero(BlockDriverState *bs, BdrvCheckResult *res,
goto fail; goto fail;
} }
ret = bdrv_pwrite_sync(bs->file, l2e_offset, l2_entry_size(s), ret = bdrv_co_pwrite_sync(bs->file, l2e_offset, l2_entry_size(s),
&l2_table[idx], 0); &l2_table[idx], 0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "ERROR: Failed to overwrite L2 " fprintf(stderr, "ERROR: Failed to overwrite L2 "
@ -1659,7 +1661,8 @@ fail:
* Returns the number of errors found by the checks or -errno if an internal * Returns the number of errors found by the checks or -errno if an internal
* error occurred. * error occurred.
*/ */
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, static int coroutine_fn GRAPH_RDLOCK
check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table,
int64_t *refcount_table_size, int64_t l2_offset, int64_t *refcount_table_size, int64_t l2_offset,
int flags, BdrvCheckMode fix, bool active) int flags, BdrvCheckMode fix, bool active)
@ -1673,7 +1676,7 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
bool metadata_overlap; bool metadata_overlap;
/* Read L2 table from disk */ /* Read L2 table from disk */
ret = bdrv_pread(bs->file, l2_offset, l2_size_bytes, l2_table, 0); ret = bdrv_co_pread(bs->file, l2_offset, l2_size_bytes, l2_table, 0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n"); fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n");
res->check_errors++; res->check_errors++;
@ -1858,10 +1861,9 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
* Returns the number of errors found by the checks or -errno if an internal * Returns the number of errors found by the checks or -errno if an internal
* error occurred. * error occurred.
*/ */
static int check_refcounts_l1(BlockDriverState *bs, static int coroutine_fn GRAPH_RDLOCK
BdrvCheckResult *res, check_refcounts_l1(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table, int64_t *refcount_table_size,
int64_t *refcount_table_size,
int64_t l1_table_offset, int l1_size, int64_t l1_table_offset, int l1_size,
int flags, BdrvCheckMode fix, bool active) int flags, BdrvCheckMode fix, bool active)
{ {
@ -1889,7 +1891,7 @@ static int check_refcounts_l1(BlockDriverState *bs,
} }
/* Read L1 table entries from disk */ /* Read L1 table entries from disk */
ret = bdrv_pread(bs->file, l1_table_offset, l1_size_bytes, l1_table, 0); ret = bdrv_co_pread(bs->file, l1_table_offset, l1_size_bytes, l1_table, 0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n"); fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n");
res->check_errors++; res->check_errors++;
@ -1949,8 +1951,8 @@ static int check_refcounts_l1(BlockDriverState *bs,
* have been already detected and sufficiently signaled by the calling function * have been already detected and sufficiently signaled by the calling function
* (qcow2_check_refcounts) by the time this function is called). * (qcow2_check_refcounts) by the time this function is called).
*/ */
static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res, static int coroutine_fn GRAPH_RDLOCK
BdrvCheckMode fix) check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size); uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size);
@ -2005,7 +2007,7 @@ static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res,
} }
} }
ret = bdrv_pread(bs->file, l2_offset, s->l2_size * l2_entry_size(s), ret = bdrv_co_pread(bs->file, l2_offset, s->l2_size * l2_entry_size(s),
l2_table, 0); l2_table, 0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "ERROR: Could not read L2 table: %s\n", fprintf(stderr, "ERROR: Could not read L2 table: %s\n",
@ -2059,8 +2061,7 @@ static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res,
goto fail; goto fail;
} }
ret = bdrv_pwrite(bs->file, l2_offset, s->cluster_size, l2_table, ret = bdrv_co_pwrite(bs->file, l2_offset, s->cluster_size, l2_table, 0);
0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "ERROR: Could not write L2 table: %s\n", fprintf(stderr, "ERROR: Could not write L2 table: %s\n",
strerror(-ret)); strerror(-ret));
@ -2083,7 +2084,8 @@ fail:
* Checks consistency of refblocks and accounts for each refblock in * Checks consistency of refblocks and accounts for each refblock in
* *refcount_table. * *refcount_table.
*/ */
static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, static int coroutine_fn GRAPH_RDLOCK
check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix, bool *rebuild, BdrvCheckMode fix, bool *rebuild,
void **refcount_table, int64_t *nb_clusters) void **refcount_table, int64_t *nb_clusters)
{ {
@ -2127,13 +2129,13 @@ static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
goto resize_fail; goto resize_fail;
} }
ret = bdrv_truncate(bs->file, offset + s->cluster_size, false, ret = bdrv_co_truncate(bs->file, offset + s->cluster_size, false,
PREALLOC_MODE_OFF, 0, &local_err); PREALLOC_MODE_OFF, 0, &local_err);
if (ret < 0) { if (ret < 0) {
error_report_err(local_err); error_report_err(local_err);
goto resize_fail; goto resize_fail;
} }
size = bdrv_getlength(bs->file->bs); size = bdrv_co_getlength(bs->file->bs);
if (size < 0) { if (size < 0) {
ret = size; ret = size;
goto resize_fail; goto resize_fail;
@ -2197,7 +2199,8 @@ resize_fail:
/* /*
* Calculates an in-memory refcount table. * Calculates an in-memory refcount table.
*/ */
static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, static int coroutine_fn GRAPH_RDLOCK
calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix, bool *rebuild, BdrvCheckMode fix, bool *rebuild,
void **refcount_table, int64_t *nb_clusters) void **refcount_table, int64_t *nb_clusters)
{ {
@ -2299,7 +2302,8 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
* Compares the actual reference count for each cluster in the image against the * Compares the actual reference count for each cluster in the image against the
* refcount as reported by the refcount structures on-disk. * refcount as reported by the refcount structures on-disk.
*/ */
static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res, static void coroutine_fn
compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix, bool *rebuild, BdrvCheckMode fix, bool *rebuild,
int64_t *highest_cluster, int64_t *highest_cluster,
void *refcount_table, int64_t nb_clusters) void *refcount_table, int64_t nb_clusters)
@ -2463,7 +2467,8 @@ static int64_t alloc_clusters_imrt(BlockDriverState *bs,
* Return whether the on-disk reftable array was resized (true/false), * Return whether the on-disk reftable array was resized (true/false),
* or -errno on error. * or -errno on error.
*/ */
static int rebuild_refcounts_write_refblocks( static int coroutine_fn GRAPH_RDLOCK
rebuild_refcounts_write_refblocks(
BlockDriverState *bs, void **refcount_table, int64_t *nb_clusters, BlockDriverState *bs, void **refcount_table, int64_t *nb_clusters,
int64_t first_cluster, int64_t end_cluster, int64_t first_cluster, int64_t end_cluster,
uint64_t **on_disk_reftable_ptr, uint32_t *on_disk_reftable_entries_ptr, uint64_t **on_disk_reftable_ptr, uint32_t *on_disk_reftable_entries_ptr,
@ -2578,7 +2583,7 @@ static int rebuild_refcounts_write_refblocks(
on_disk_refblock = (void *)((char *) *refcount_table + on_disk_refblock = (void *)((char *) *refcount_table +
refblock_index * s->cluster_size); refblock_index * s->cluster_size);
ret = bdrv_pwrite(bs->file, refblock_offset, s->cluster_size, ret = bdrv_co_pwrite(bs->file, refblock_offset, s->cluster_size,
on_disk_refblock, 0); on_disk_refblock, 0);
if (ret < 0) { if (ret < 0) {
error_setg_errno(errp, -ret, "ERROR writing refblock"); error_setg_errno(errp, -ret, "ERROR writing refblock");
@ -2601,10 +2606,9 @@ static int rebuild_refcounts_write_refblocks(
* On success, the old refcount structure is leaked (it will be covered by the * On success, the old refcount structure is leaked (it will be covered by the
* new refcount structure). * new refcount structure).
*/ */
static int rebuild_refcount_structure(BlockDriverState *bs, static int coroutine_fn GRAPH_RDLOCK
BdrvCheckResult *res, rebuild_refcount_structure(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table, int64_t *nb_clusters,
int64_t *nb_clusters,
Error **errp) Error **errp)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
@ -2734,7 +2738,7 @@ static int rebuild_refcount_structure(BlockDriverState *bs,
} }
assert(reftable_length < INT_MAX); assert(reftable_length < INT_MAX);
ret = bdrv_pwrite(bs->file, reftable_offset, reftable_length, ret = bdrv_co_pwrite(bs->file, reftable_offset, reftable_length,
on_disk_reftable, 0); on_disk_reftable, 0);
if (ret < 0) { if (ret < 0) {
error_setg_errno(errp, -ret, "ERROR writing reftable"); error_setg_errno(errp, -ret, "ERROR writing reftable");
@ -2745,7 +2749,7 @@ static int rebuild_refcount_structure(BlockDriverState *bs,
reftable_offset_and_clusters.reftable_offset = cpu_to_be64(reftable_offset); reftable_offset_and_clusters.reftable_offset = cpu_to_be64(reftable_offset);
reftable_offset_and_clusters.reftable_clusters = reftable_offset_and_clusters.reftable_clusters =
cpu_to_be32(reftable_clusters); cpu_to_be32(reftable_clusters);
ret = bdrv_pwrite_sync(bs->file, ret = bdrv_co_pwrite_sync(bs->file,
offsetof(QCowHeader, refcount_table_offset), offsetof(QCowHeader, refcount_table_offset),
sizeof(reftable_offset_and_clusters), sizeof(reftable_offset_and_clusters),
&reftable_offset_and_clusters, 0); &reftable_offset_and_clusters, 0);
@ -2777,8 +2781,8 @@ fail:
* Returns 0 if no errors are found, the number of errors in case the image is * Returns 0 if no errors are found, the number of errors in case the image is
* detected as corrupted, and -errno when an internal error occurred. * detected as corrupted, and -errno when an internal error occurred.
*/ */
int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn GRAPH_RDLOCK
BdrvCheckMode fix) qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
BdrvCheckResult pre_compare_res; BdrvCheckResult pre_compare_res;
@ -2787,7 +2791,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
bool rebuild = false; bool rebuild = false;
int ret; int ret;
size = bdrv_getlength(bs->file->bs); size = bdrv_co_getlength(bs->file->bs);
if (size < 0) { if (size < 0) {
res->check_errors++; res->check_errors++;
return size; return size;
@ -3541,7 +3545,8 @@ done:
return ret; return ret;
} }
static int64_t get_refblock_offset(BlockDriverState *bs, uint64_t offset) static int64_t coroutine_fn get_refblock_offset(BlockDriverState *bs,
uint64_t offset)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
uint32_t index = offset_to_reftable_index(s, offset); uint32_t index = offset_to_reftable_index(s, offset);
@ -3707,7 +3712,8 @@ int64_t coroutine_fn qcow2_get_last_cluster(BlockDriverState *bs, int64_t size)
return -EIO; return -EIO;
} }
int coroutine_fn qcow2_detect_metadata_preallocation(BlockDriverState *bs) int coroutine_fn GRAPH_RDLOCK
qcow2_detect_metadata_preallocation(BlockDriverState *bs)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;
int64_t i, end_cluster, cluster_count = 0, threshold; int64_t i, end_cluster, cluster_count = 0, threshold;

View File

@ -570,7 +570,7 @@ int qcow2_mark_corrupt(BlockDriverState *bs)
* Marks the image as consistent, i.e., unsets the corrupt bit, and flushes * Marks the image as consistent, i.e., unsets the corrupt bit, and flushes
* before if necessary. * before if necessary.
*/ */
int qcow2_mark_consistent(BlockDriverState *bs) static int coroutine_fn qcow2_mark_consistent(BlockDriverState *bs)
{ {
BDRVQcow2State *s = bs->opaque; BDRVQcow2State *s = bs->opaque;

View File

@ -836,7 +836,6 @@ int64_t qcow2_refcount_metadata_size(int64_t clusters, size_t cluster_size,
int qcow2_mark_dirty(BlockDriverState *bs); int qcow2_mark_dirty(BlockDriverState *bs);
int qcow2_mark_corrupt(BlockDriverState *bs); int qcow2_mark_corrupt(BlockDriverState *bs);
int qcow2_mark_consistent(BlockDriverState *bs);
int qcow2_update_header(BlockDriverState *bs); int qcow2_update_header(BlockDriverState *bs);
void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset, void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
@ -867,7 +866,7 @@ int64_t qcow2_refcount_area(BlockDriverState *bs, uint64_t offset,
int64_t qcow2_alloc_clusters(BlockDriverState *bs, uint64_t size); int64_t qcow2_alloc_clusters(BlockDriverState *bs, uint64_t size);
int64_t coroutine_fn qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset, int64_t coroutine_fn qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset,
int64_t nb_clusters); int64_t nb_clusters);
int64_t coroutine_fn qcow2_alloc_bytes(BlockDriverState *bs, int size); int64_t coroutine_fn GRAPH_RDLOCK qcow2_alloc_bytes(BlockDriverState *bs, int size);
void qcow2_free_clusters(BlockDriverState *bs, void qcow2_free_clusters(BlockDriverState *bs,
int64_t offset, int64_t size, int64_t offset, int64_t size,
enum qcow2_discard_type type); enum qcow2_discard_type type);
@ -879,7 +878,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
int qcow2_flush_caches(BlockDriverState *bs); int qcow2_flush_caches(BlockDriverState *bs);
int qcow2_write_caches(BlockDriverState *bs); int qcow2_write_caches(BlockDriverState *bs);
int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix); BdrvCheckMode fix);
void qcow2_process_discards(BlockDriverState *bs, int ret); void qcow2_process_discards(BlockDriverState *bs, int ret);
@ -888,7 +887,7 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset,
int64_t size); int64_t size);
int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t offset, int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t offset,
int64_t size, bool data_file); int64_t size, bool data_file);
int qcow2_inc_refcounts_imrt(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn qcow2_inc_refcounts_imrt(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table,
int64_t *refcount_table_size, int64_t *refcount_table_size,
int64_t offset, int64_t size); int64_t offset, int64_t size);
@ -919,10 +918,9 @@ int qcow2_get_host_offset(BlockDriverState *bs, uint64_t offset,
int coroutine_fn qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset, int coroutine_fn qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset,
unsigned int *bytes, unsigned int *bytes,
uint64_t *host_offset, QCowL2Meta **m); uint64_t *host_offset, QCowL2Meta **m);
int coroutine_fn qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, int coroutine_fn GRAPH_RDLOCK
uint64_t offset, qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, uint64_t offset,
int compressed_size, int compressed_size, uint64_t *host_offset);
uint64_t *host_offset);
void qcow2_parse_compressed_l2_entry(BlockDriverState *bs, uint64_t l2_entry, void qcow2_parse_compressed_l2_entry(BlockDriverState *bs, uint64_t l2_entry,
uint64_t *coffset, int *csize); uint64_t *coffset, int *csize);
@ -992,11 +990,12 @@ void *qcow2_cache_is_table_offset(Qcow2Cache *c, uint64_t offset);
void qcow2_cache_discard(Qcow2Cache *c, void *table); void qcow2_cache_discard(Qcow2Cache *c, void *table);
/* qcow2-bitmap.c functions */ /* qcow2-bitmap.c functions */
int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res, int coroutine_fn
qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
void **refcount_table, void **refcount_table,
int64_t *refcount_table_size); int64_t *refcount_table_size);
bool coroutine_fn qcow2_load_dirty_bitmaps(BlockDriverState *bs, bool coroutine_fn GRAPH_RDLOCK
bool *header_updated, Error **errp); qcow2_load_dirty_bitmaps(BlockDriverState *bs, bool *header_updated, Error **errp);
bool qcow2_get_bitmap_info_list(BlockDriverState *bs, bool qcow2_get_bitmap_info_list(BlockDriverState *bs,
Qcow2BitmapInfoList **info_list, Error **errp); Qcow2BitmapInfoList **info_list, Error **errp);
int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp); int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp);