[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/23] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK
From: |
Kevin Wolf |
Subject: |
[PULL 13/23] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK |
Date: |
Wed, 28 Jun 2023 16:15:16 +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-3-pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qed-check.c | 5 +++--
block/qed.c | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/block/qed-check.c b/block/qed-check.c
index 8fd94f405e..6a01b94f9c 100644
--- a/block/qed-check.c
+++ b/block/qed-check.c
@@ -200,7 +200,8 @@ static void qed_check_for_leaks(QEDCheck *check)
/**
* Mark an image clean once it passes check or has been repaired
*/
-static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result)
+static void coroutine_fn GRAPH_RDLOCK
+qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result)
{
/* Skip if there were unfixable corruptions or I/O errors */
if (result->corruptions > 0 || result->check_errors > 0) {
@@ -213,7 +214,7 @@ static void qed_check_mark_clean(BDRVQEDState *s,
BdrvCheckResult *result)
}
/* Ensure fixes reach storage before clearing check bit */
- bdrv_flush(s->bs);
+ bdrv_co_flush(s->bs);
s->header.features &= ~QED_F_NEED_CHECK;
qed_write_header_sync(s);
diff --git a/block/qed.c b/block/qed.c
index 9a0350b534..2cab3540a9 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -195,14 +195,15 @@ static bool qed_is_image_size_valid(uint64_t image_size,
uint32_t cluster_size,
*
* The string is NUL-terminated.
*/
-static int qed_read_string(BdrvChild *file, uint64_t offset, size_t n,
- char *buf, size_t buflen)
+static int coroutine_fn GRAPH_RDLOCK
+qed_read_string(BdrvChild *file, uint64_t offset,
+ size_t n, char *buf, size_t buflen)
{
int ret;
if (n >= buflen) {
return -EINVAL;
}
- ret = bdrv_pread(file, offset, n, buf, 0);
+ ret = bdrv_co_pread(file, offset, n, buf, 0);
if (ret < 0) {
return ret;
}
--
2.41.0
- [PULL 20/23] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK, (continued)
- [PULL 20/23] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 11/23] Revert "graph-lock: Disable locking for now", Kevin Wolf, 2023/06/28
- [PULL 10/23] graph-lock: Unlock the AioContext while polling, Kevin Wolf, 2023/06/28
- [PULL 21/23] qcow2: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 19/23] vmdk: 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 08/23] block: Fix AioContext locking in bdrv_open_backing_file(), Kevin Wolf, 2023/06/28
- [PULL 16/23] block: mark another function as coroutine_fns and GRAPH_UNLOCKED, Kevin Wolf, 2023/06/28
- [PULL 17/23] cloop: 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 13/23] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK,
Kevin Wolf <=
- [PULL 06/23] block: Fix AioContext locking in bdrv_reopen_parse_file_or_backing(), Kevin Wolf, 2023/06/28
- [PULL 15/23] bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- [PULL 23/23] block: use bdrv_co_debug_event in coroutine context, Kevin Wolf, 2023/06/28
- [PULL 22/23] block: use bdrv_co_getlength in coroutine context, Kevin Wolf, 2023/06/28
- [PULL 18/23] dmg: mark more functions as coroutine_fns and GRAPH_RDLOCK, Kevin Wolf, 2023/06/28
- Re: [PULL 00/23] Block layer patches, Richard Henderson, 2023/06/29