[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/12] cloop: mark more functions as coroutine_fns and GRAPH_RDLO
From: |
Paolo Bonzini |
Subject: |
[PATCH 06/12] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK |
Date: |
Thu, 1 Jun 2023 13:51:39 +0200 |
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>
---
block/cloop.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/block/cloop.c b/block/cloop.c
index 1e5a52d6b2dc..835a0fe3da0a 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -212,7 +212,8 @@ static void cloop_refresh_limits(BlockDriverState *bs,
Error **errp)
bs->bl.request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O */
}
-static inline int cloop_read_block(BlockDriverState *bs, int block_num)
+static int coroutine_fn GRAPH_RDLOCK
+cloop_read_block(BlockDriverState *bs, int block_num)
{
BDRVCloopState *s = bs->opaque;
@@ -220,8 +221,8 @@ static inline int cloop_read_block(BlockDriverState *bs,
int block_num)
int ret;
uint32_t bytes = s->offsets[block_num + 1] - s->offsets[block_num];
- ret = bdrv_pread(bs->file, s->offsets[block_num], bytes,
- s->compressed_block, 0);
+ ret = bdrv_co_pread(bs->file, s->offsets[block_num], bytes,
+ s->compressed_block, 0);
if (ret < 0) {
return -1;
}
@@ -244,7 +245,7 @@ static inline int cloop_read_block(BlockDriverState *bs,
int block_num)
return 0;
}
-static int coroutine_fn
+static int coroutine_fn GRAPH_RDLOCK
cloop_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
QEMUIOVector *qiov, BdrvRequestFlags flags)
{
--
2.40.1
- [PATCH 00/12] block: more fixes to coroutine_fn marking, Paolo Bonzini, 2023/06/01
- [PATCH 01/12] file-posix: remove incorrect coroutine_fn calls, Paolo Bonzini, 2023/06/01
- [PATCH 03/12] vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 05/12] block: mark another function as coroutine_fns and GRAPH_UNLOCKED, Paolo Bonzini, 2023/06/01
- [PATCH 04/12] bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 06/12] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK,
Paolo Bonzini <=
- [PATCH 02/12] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 08/12] vmdk: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 11/12] block: use bdrv_co_getlength in coroutine context, Paolo Bonzini, 2023/06/01
- [PATCH 07/12] dmg: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 09/12] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 10/12] qcow2: mark more functions as coroutine_fns and GRAPH_RDLOCK, Paolo Bonzini, 2023/06/01
- [PATCH 12/12] block: use bdrv_co_debug_event in coroutine context, Paolo Bonzini, 2023/06/01
- Re: [PATCH 00/12] block: more fixes to coroutine_fn marking, Kevin Wolf, 2023/06/28