diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-06-01 13:51:44 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-06-28 09:46:33 +0200 |
commit | 0af02bd10783e08220a784eb8d7e2f821a64f0fa (patch) | |
tree | 70d64c562f7258fa7ff549a5d9c003340a11ab55 /block/io.c | |
parent | 70bacc44532f6324473b8d701705cd003e2fe678 (diff) |
block: use bdrv_co_getlength in coroutine context
bdrv_co_getlength was recently introduced, with bdrv_getlength becoming
a wrapper for use in unknown context. Switch to bdrv_co_getlength when
possible.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20230601115145.196465-12-pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/block/io.c b/block/io.c index 30748f0b59..b53253c7a7 100644 --- a/block/io.c +++ b/block/io.c @@ -1379,7 +1379,7 @@ bdrv_aligned_preadv(BdrvChild *child, BdrvTrackedRequest *req, } /* Forward the request to the BlockDriver, possibly fragmenting it */ - total_bytes = bdrv_getlength(bs); + total_bytes = bdrv_co_getlength(bs); if (total_bytes < 0) { ret = total_bytes; goto out; @@ -2388,7 +2388,7 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_zero, assert(pnum); assert_bdrv_graph_readable(); *pnum = 0; - total_size = bdrv_getlength(bs); + total_size = bdrv_co_getlength(bs); if (total_size < 0) { ret = total_size; goto early_out; @@ -2408,7 +2408,7 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_zero, bytes = n; } - /* Must be non-NULL or bdrv_getlength() would have failed */ + /* Must be non-NULL or bdrv_co_getlength() would have failed */ assert(bs->drv); has_filtered_child = bdrv_filter_child(bs); if (!bs->drv->bdrv_co_block_status && !has_filtered_child) { @@ -2546,7 +2546,7 @@ bdrv_co_block_status(BlockDriverState *bs, bool want_zero, if (!cow_bs) { ret |= BDRV_BLOCK_ZERO; } else if (want_zero) { - int64_t size2 = bdrv_getlength(cow_bs); + int64_t size2 = bdrv_co_getlength(cow_bs); if (size2 >= 0 && offset >= size2) { ret |= BDRV_BLOCK_ZERO; @@ -3592,7 +3592,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact, return ret; } - old_size = bdrv_getlength(bs); + old_size = bdrv_co_getlength(bs); if (old_size < 0) { error_setg_errno(errp, -old_size, "Failed to get old image size"); return old_size; |