[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/9] block-copy: add missing coroutine_fn annotations
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v2 2/9] block-copy: add missing coroutine_fn annotations |
Date: |
Fri, 4 Nov 2022 05:56:53 -0400 |
These functions end up calling bdrv_common_block_status_above(), a
generated_co_wrapper function.
In addition, they also happen to be always called in coroutine context,
meaning all callers are coroutine_fn.
This means that the g_c_w function will enter the qemu_in_coroutine()
case and eventually suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/block-copy.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/block-copy.c b/block/block-copy.c
index bb947afdda..f33ab1d0b6 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -577,8 +577,9 @@ static coroutine_fn int block_copy_task_entry(AioTask *task)
return ret;
}
-static int block_copy_block_status(BlockCopyState *s, int64_t offset,
- int64_t bytes, int64_t *pnum)
+static coroutine_fn int block_copy_block_status(BlockCopyState *s,
+ int64_t offset,
+ int64_t bytes, int64_t *pnum)
{
int64_t num;
BlockDriverState *base;
@@ -613,8 +614,9 @@ static int block_copy_block_status(BlockCopyState *s,
int64_t offset,
* Check if the cluster starting at offset is allocated or not.
* return via pnum the number of contiguous clusters sharing this allocation.
*/
-static int block_copy_is_cluster_allocated(BlockCopyState *s, int64_t offset,
- int64_t *pnum)
+static int coroutine_fn block_copy_is_cluster_allocated(BlockCopyState *s,
+ int64_t offset,
+ int64_t *pnum)
{
BlockDriverState *bs = s->source->bs;
int64_t count, total_count = 0;
@@ -669,8 +671,9 @@ void block_copy_reset(BlockCopyState *s, int64_t offset,
int64_t bytes)
* @return 0 when the cluster at @offset was unallocated,
* 1 otherwise, and -ret on error.
*/
-int64_t block_copy_reset_unallocated(BlockCopyState *s,
- int64_t offset, int64_t *count)
+int64_t coroutine_fn block_copy_reset_unallocated(BlockCopyState *s,
+ int64_t offset,
+ int64_t *count)
{
int ret;
int64_t clusters, bytes;
--
2.31.1
[PATCH v2 9/9] block/dirty-bitmap: remove unnecessary qemu_in_coroutine() case, Emanuele Giuseppe Esposito, 2022/11/04
[PATCH v2 2/9] block-copy: add missing coroutine_fn annotations,
Emanuele Giuseppe Esposito <=
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/09
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Alberto Faria, 2022/11/09
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Paolo Bonzini, 2022/11/10
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/15
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Paolo Bonzini, 2022/11/16
[PATCH v2 3/9] nbd/server.c: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/04