[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/38] block: use bdrv_co_refresh_total_sectors when possible
From: |
Kevin Wolf |
Subject: |
[PULL 19/38] block: use bdrv_co_refresh_total_sectors when possible |
Date: |
Fri, 20 Jan 2023 13:26:14 +0100 |
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
In some places we are sure we are always running in a
coroutine, therefore it's useless to call the generated_co_wrapper,
instead call directly the _co_ function.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230113204212.359076-9-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/block-backend.c | 6 +++---
block/io.c | 4 ++--
block/preallocate.c | 6 +++---
block/qed.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 7d4b08ee45..b4a8d259cf 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1235,8 +1235,8 @@ void blk_set_disable_request_queuing(BlockBackend *blk,
bool disable)
blk->disable_request_queuing = disable;
}
-static int blk_check_byte_request(BlockBackend *blk, int64_t offset,
- int64_t bytes)
+static coroutine_fn int blk_check_byte_request(BlockBackend *blk,
+ int64_t offset, int64_t bytes)
{
int64_t len;
@@ -1253,7 +1253,7 @@ static int blk_check_byte_request(BlockBackend *blk,
int64_t offset,
}
if (!blk->allow_write_beyond_eof) {
- len = bdrv_getlength(blk_bs(blk));
+ len = bdrv_co_getlength(blk_bs(blk));
if (len < 0) {
return len;
}
diff --git a/block/io.c b/block/io.c
index e5e51563a5..fdc5ba9fb6 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3443,7 +3443,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child,
int64_t offset, bool exact,
if (new_bytes && backing) {
int64_t backing_len;
- backing_len = bdrv_getlength(backing->bs);
+ backing_len = bdrv_co_getlength(backing->bs);
if (backing_len < 0) {
ret = backing_len;
error_setg_errno(errp, -ret, "Could not get backing file size");
@@ -3473,7 +3473,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child,
int64_t offset, bool exact,
goto out;
}
- ret = bdrv_refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
+ ret = bdrv_co_refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not refresh total sector count");
} else {
diff --git a/block/preallocate.c b/block/preallocate.c
index 94aa824e09..5815d7a78b 100644
--- a/block/preallocate.c
+++ b/block/preallocate.c
@@ -286,7 +286,7 @@ static bool coroutine_fn handle_write(BlockDriverState *bs,
int64_t offset,
}
if (s->data_end < 0) {
- s->data_end = bdrv_getlength(bs->file->bs);
+ s->data_end = bdrv_co_getlength(bs->file->bs);
if (s->data_end < 0) {
return false;
}
@@ -308,7 +308,7 @@ static bool coroutine_fn handle_write(BlockDriverState *bs,
int64_t offset,
}
if (s->file_end < 0) {
- s->file_end = bdrv_getlength(bs->file->bs);
+ s->file_end = bdrv_co_getlength(bs->file->bs);
if (s->file_end < 0) {
return false;
}
@@ -380,7 +380,7 @@ preallocate_co_truncate(BlockDriverState *bs, int64_t
offset,
if (s->data_end >= 0 && offset > s->data_end) {
if (s->file_end < 0) {
- s->file_end = bdrv_getlength(bs->file->bs);
+ s->file_end = bdrv_co_getlength(bs->file->bs);
if (s->file_end < 0) {
error_setg(errp, "failed to get file length");
return s->file_end;
diff --git a/block/qed.c b/block/qed.c
index c8f9045b72..16bf0cb080 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -424,7 +424,7 @@ static int coroutine_fn bdrv_qed_do_open(BlockDriverState
*bs, QDict *options,
}
/* Round down file size to the last cluster */
- file_size = bdrv_getlength(bs->file->bs);
+ file_size = bdrv_co_getlength(bs->file->bs);
if (file_size < 0) {
error_setg(errp, "Failed to get file length");
return file_size;
--
2.38.1
- [PULL 08/38] qcow2: Fix theoretical corruption in store_bitmap() error path, (continued)
- [PULL 08/38] qcow2: Fix theoretical corruption in store_bitmap() error path, Kevin Wolf, 2023/01/20
- [PULL 05/38] block: Add no_coroutine_fn and coroutine_mixed_fn marker, Kevin Wolf, 2023/01/20
- [PULL 10/38] qemu-img bitmap: Report errors while closing the image, Kevin Wolf, 2023/01/20
- [PULL 11/38] qemu-iotests: Test qemu-img bitmap/commit exit code on error, Kevin Wolf, 2023/01/20
- [PULL 09/38] qemu-img commit: Report errors while closing the image, Kevin Wolf, 2023/01/20
- [PULL 13/38] block: Convert bdrv_io_plug() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 12/38] block-coroutine-wrapper: support void functions, Kevin Wolf, 2023/01/20
- [PULL 14/38] block: Convert bdrv_io_unplug() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 15/38] block: Convert bdrv_is_inserted() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 20/38] block: Convert bdrv_get_allocated_file_size() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 19/38] block: use bdrv_co_refresh_total_sectors when possible,
Kevin Wolf <=
- [PULL 16/38] block: Rename refresh_total_sectors to bdrv_refresh_total_sectors, Kevin Wolf, 2023/01/20
- [PULL 17/38] block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed, Kevin Wolf, 2023/01/20
- [PULL 21/38] block: Convert bdrv_get_info() to co_wrapper_mixed, Kevin Wolf, 2023/01/20
- [PULL 18/38] block-backend: use bdrv_getlength instead of blk_getlength, Kevin Wolf, 2023/01/20
- [PULL 28/38] block/file: Add file-specific image info, Kevin Wolf, 2023/01/20
- [PULL 25/38] block: Rename bdrv_load/save_vmstate() to bdrv_co_load/save_vmstate(), Kevin Wolf, 2023/01/20
- [PULL 23/38] block: Convert bdrv_lock_medium() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 22/38] block: Convert bdrv_eject() to co_wrapper, Kevin Wolf, 2023/01/20
- [PULL 30/38] block: Split BlockNodeInfo off of ImageInfo, Kevin Wolf, 2023/01/20
- [PULL 29/38] block/vmdk: Change extent info type, Kevin Wolf, 2023/01/20