[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/23] cloop: mark more functions as coroutine_fns and GRAPH_RDLOC
From: |
Kevin Wolf |
Subject: |
[PULL 17/23] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK |
Date: |
Wed, 28 Jun 2023 16:15:20 +0200 |
From: Paolo Bonzini <pbonzini@redhat.com>
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-7-pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/cloop.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/block/cloop.c b/block/cloop.c
index 1e5a52d6b2..835a0fe3da 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.41.0
- [PULL 00/23] Block layer patches, Kevin Wolf, 2023/06/28
- [PULL 01/23] iotests: Test active commit with iothread and background I/O, Kevin Wolf, 2023/06/28
- [PULL 04/23] block: Fix AioContext locking in bdrv_open_child(), Kevin Wolf, 2023/06/28
- [PULL 02/23] qdev-properties-system: Lock AioContext for blk_insert_bs(), Kevin Wolf, 2023/06/28
- [PULL 05/23] block: Fix AioContext locking in bdrv_attach_child_common(), Kevin Wolf, 2023/06/28
- [PULL 11/23] Revert "graph-lock: Disable locking for now", Kevin Wolf, 2023/06/28
- [PULL 06/23] block: Fix AioContext locking in bdrv_reopen_parse_file_or_backing(), Kevin Wolf, 2023/06/28
- [PULL 17/23] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK,
Kevin Wolf <=
- [PULL 08/23] block: Fix AioContext locking in bdrv_open_backing_file(), Kevin Wolf, 2023/06/28
- [PULL 10/23] graph-lock: Unlock the AioContext while polling, Kevin Wolf, 2023/06/28
- [PULL 07/23] block: Fix AioContext locking in bdrv_open_inherit(), Kevin Wolf, 2023/06/28
- [PULL 14/23] vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 13/23] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 03/23] test-block-iothread: Lock AioContext for blk_insert_bs(), Kevin Wolf, 2023/06/28
- [PULL 09/23] blockjob: Fix AioContext locking in block_job_add_bdrv(), Kevin Wolf, 2023/06/28
- [PULL 20/23] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 12/23] file-posix: remove incorrect coroutine_fn calls, Kevin Wolf, 2023/06/28
- [PULL 19/23] vmdk: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28