diff mbox series

[PULL,17/19] block: mark mixed functions that can suspend

Message ID 20230926165915.738719-18-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/19] pc_piix: remove pc-i440fx-1.4 up to pc-i440fx-1.7 | expand

Commit Message

Paolo Bonzini Sept. 26, 2023, 4:59 p.m. UTC
The marking should be extended transitively to all functions that call
these ones, so that static analysis can be done much more efficiently.
However, this is a start and makes it possible to use vrc's path-based
searches to find potential bugs where coroutine_fns call blocking functions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/io.c              | 5 +++--
 block/qcow2.c           | 2 +-
 block/qed.c             | 4 ++--
 block/throttle-groups.c | 4 ++--
 4 files changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/block/io.c b/block/io.c
index 209a6da0c8e..e7f9448d5a3 100644
--- a/block/io.c
+++ b/block/io.c
@@ -387,7 +387,8 @@  void bdrv_do_drained_begin_quiesce(BlockDriverState *bs, BdrvChild *parent)
     bdrv_do_drained_begin(bs, parent, false);
 }
 
-void bdrv_drained_begin(BlockDriverState *bs)
+void coroutine_mixed_fn
+bdrv_drained_begin(BlockDriverState *bs)
 {
     IO_OR_GS_CODE();
     bdrv_do_drained_begin(bs, NULL, true);
@@ -506,7 +507,7 @@  void bdrv_drain_all_begin_nopoll(void)
     }
 }
 
-void bdrv_drain_all_begin(void)
+void coroutine_mixed_fn bdrv_drain_all_begin(void)
 {
     BlockDriverState *bs = NULL;
 
diff --git a/block/qcow2.c b/block/qcow2.c
index af43d59d768..5a3c537f146 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -5288,7 +5288,7 @@  static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,
     return spec_info;
 }
 
-static int qcow2_has_zero_init(BlockDriverState *bs)
+static int coroutine_mixed_fn qcow2_has_zero_init(BlockDriverState *bs)
 {
     BDRVQcow2State *s = bs->opaque;
     bool preallocated;
diff --git a/block/qed.c b/block/qed.c
index b2604d9dad3..45ae320290d 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -570,8 +570,8 @@  static void coroutine_fn bdrv_qed_open_entry(void *opaque)
     qemu_co_mutex_unlock(&s->table_lock);
 }
 
-static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
-                         Error **errp)
+static int coroutine_mixed_fn bdrv_qed_open(BlockDriverState *bs, QDict *options,
+                                            int flags, Error **errp)
 {
     QEDOpenCo qoc = {
         .bs = bs,
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 3eda4c4e3de..f5c0fac5814 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -317,8 +317,8 @@  static bool coroutine_fn throttle_group_co_restart_queue(ThrottleGroupMember *tg
  * @tgm:       the current ThrottleGroupMember
  * @direction: the ThrottleDirection
  */
-static void schedule_next_request(ThrottleGroupMember *tgm,
-                                  ThrottleDirection direction)
+static void coroutine_mixed_fn schedule_next_request(ThrottleGroupMember *tgm,
+                                                     ThrottleDirection direction)
 {
     ThrottleState *ts = tgm->throttle_state;
     ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);