All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, afaria@redhat.com
Subject: [PATCH 14/26] qcow2: add missing coroutine_fn annotations
Date: Thu, 22 Sep 2022 10:49:12 +0200	[thread overview]
Message-ID: <20220922084924.201610-15-pbonzini@redhat.com> (raw)
In-Reply-To: <20220922084924.201610-1-pbonzini@redhat.com>

Callers of coroutine_fn must be coroutine_fn themselves, or the call
must be within "if (qemu_in_coroutine())".  Apply coroutine_fn to
functions where this holds.

Reviewed-by: Alberto Faria <afaria@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/qcow2-cluster.c  | 18 +++++++++---------
 block/qcow2-refcount.c |  2 +-
 block/qcow2.c          |  4 ++--
 block/qcow2.h          | 14 +++++++-------
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index fd32316d6f..f6a12ed510 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -884,7 +884,7 @@ int qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
     return 0;
 }
 
-static int perform_cow(BlockDriverState *bs, QCowL2Meta *m)
+static int coroutine_fn perform_cow(BlockDriverState *bs, QCowL2Meta *m)
 {
     BDRVQcow2State *s = bs->opaque;
     Qcow2COWRegion *start = &m->cow_start;
@@ -1024,7 +1024,7 @@ fail:
     return ret;
 }
 
-int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
+int coroutine_fn qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
 {
     BDRVQcow2State *s = bs->opaque;
     int i, j = 0, l2_index, ret;
@@ -1397,8 +1397,8 @@ static int count_single_write_clusters(BlockDriverState *bs, int nb_clusters,
  *           information on cluster allocation may be invalid now. The caller
  *           must start over anyway, so consider *cur_bytes undefined.
  */
-static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset,
-    uint64_t *cur_bytes, QCowL2Meta **m)
+static int coroutine_fn handle_dependencies(BlockDriverState *bs, uint64_t guest_offset,
+                                            uint64_t *cur_bytes, QCowL2Meta **m)
 {
     BDRVQcow2State *s = bs->opaque;
     QCowL2Meta *old_alloc;
@@ -1772,9 +1772,9 @@ out:
  *
  * Return 0 on success and -errno in error cases
  */
-int qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset,
-                            unsigned int *bytes, uint64_t *host_offset,
-                            QCowL2Meta **m)
+int coroutine_fn qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset,
+                                         unsigned int *bytes, uint64_t *host_offset,
+                                         QCowL2Meta **m)
 {
     BDRVQcow2State *s = bs->opaque;
     uint64_t start, remaining;
@@ -2105,8 +2105,8 @@ out:
     return ret;
 }
 
-int qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
-                             uint64_t bytes, int flags)
+int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
+                                          uint64_t bytes, int flags)
 {
     BDRVQcow2State *s = bs->opaque;
     uint64_t end_offset = offset + bytes;
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 1a6277c783..1fbb07ca77 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -3706,7 +3706,7 @@ int64_t qcow2_get_last_cluster(BlockDriverState *bs, int64_t size)
     return -EIO;
 }
 
-int qcow2_detect_metadata_preallocation(BlockDriverState *bs)
+int coroutine_fn qcow2_detect_metadata_preallocation(BlockDriverState *bs)
 {
     BDRVQcow2State *s = bs->opaque;
     int64_t i, end_cluster, cluster_count = 0, threshold;
diff --git a/block/qcow2.c b/block/qcow2.c
index c6c6692fb7..b4d04e91fa 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2436,7 +2436,7 @@ static bool merge_cow(uint64_t offset, unsigned bytes,
  * Return 1 if the COW regions read as zeroes, 0 if not, < 0 on error.
  * Note that returning 0 does not guarantee non-zero data.
  */
-static int is_zero_cow(BlockDriverState *bs, QCowL2Meta *m)
+static int coroutine_fn is_zero_cow(BlockDriverState *bs, QCowL2Meta *m)
 {
     /*
      * This check is designed for optimization shortcut so it must be
@@ -2454,7 +2454,7 @@ static int is_zero_cow(BlockDriverState *bs, QCowL2Meta *m)
                                 m->cow_end.nb_bytes);
 }
 
-static int handle_alloc_space(BlockDriverState *bs, QCowL2Meta *l2meta)
+static int coroutine_fn handle_alloc_space(BlockDriverState *bs, QCowL2Meta *l2meta)
 {
     BDRVQcow2State *s = bs->opaque;
     QCowL2Meta *m;
diff --git a/block/qcow2.h b/block/qcow2.h
index c8d9e8ea79..36495d9051 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -895,7 +895,7 @@ int qcow2_change_refcount_order(BlockDriverState *bs, int refcount_order,
                                 void *cb_opaque, Error **errp);
 int qcow2_shrink_reftable(BlockDriverState *bs);
 int64_t qcow2_get_last_cluster(BlockDriverState *bs, int64_t size);
-int qcow2_detect_metadata_preallocation(BlockDriverState *bs);
+int coroutine_fn qcow2_detect_metadata_preallocation(BlockDriverState *bs);
 
 /* qcow2-cluster.c functions */
 int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
@@ -908,9 +908,9 @@ int qcow2_encrypt_sectors(BDRVQcow2State *s, int64_t sector_num,
 int qcow2_get_host_offset(BlockDriverState *bs, uint64_t offset,
                           unsigned int *bytes, uint64_t *host_offset,
                           QCow2SubclusterType *subcluster_type);
-int qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset,
-                            unsigned int *bytes, uint64_t *host_offset,
-                            QCowL2Meta **m);
+int coroutine_fn qcow2_alloc_host_offset(BlockDriverState *bs, uint64_t offset,
+                                         unsigned int *bytes, uint64_t *host_offset,
+                                         QCowL2Meta **m);
 int qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
                                           uint64_t offset,
                                           int compressed_size,
@@ -918,13 +918,13 @@ int qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
 void qcow2_parse_compressed_l2_entry(BlockDriverState *bs, uint64_t l2_entry,
                                      uint64_t *coffset, int *csize);
 
-int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m);
+int coroutine_fn qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m);
 void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m);
 int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,
                           uint64_t bytes, enum qcow2_discard_type type,
                           bool full_discard);
-int qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
-                             uint64_t bytes, int flags);
+int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
+                                          uint64_t bytes, int flags);
 
 int qcow2_expand_zero_clusters(BlockDriverState *bs,
                                BlockDriverAmendStatusCB *status_cb,
-- 
2.37.3



  parent reply	other threads:[~2022-09-22  9:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  8:48 [PATCH v3 00/26] block: fix coroutine_fn annotations Paolo Bonzini
2022-09-22  8:48 ` [PATCH 01/26] block/nvme: separate nvme_get_free_req cases for coroutine/non-coroutine context Paolo Bonzini
2022-09-22  8:49 ` [PATCH 02/26] block: add missing coroutine_fn annotations Paolo Bonzini
2022-09-22 15:11   ` Alberto Campinho Faria
2022-09-24 13:41     ` Paolo Bonzini
2022-10-05 18:11       ` Alberto Campinho Faria
2022-09-22  8:49 ` [PATCH 03/26] qcow2: remove incorrect " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 04/26] nbd: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 05/26] coroutine: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 06/26] blkdebug: add missing " Paolo Bonzini
2022-10-05 10:32   ` Kevin Wolf
2022-10-05 21:11     ` Paolo Bonzini
2022-10-06  8:45       ` Kevin Wolf
2022-09-22  8:49 ` [PATCH 07/26] blkverify: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 08/26] file-posix: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 09/26] iscsi: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 10/26] nbd: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 11/26] nfs: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 12/26] nvme: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 13/26] parallels: " Paolo Bonzini
2022-10-05 10:44   ` Kevin Wolf
2022-09-22  8:49 ` Paolo Bonzini [this message]
2022-09-22  8:49 ` [PATCH 15/26] copy-before-write: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 16/26] curl: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 17/26] qed: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 18/26] quorum: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 19/26] throttle: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 20/26] vmdk: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 21/26] job: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 22/26] coroutine-lock: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 23/26] raw-format: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 24/26] 9p: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 25/26] migration: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 26/26] test-coroutine: " Paolo Bonzini
2022-10-06 12:17 ` [PATCH v3 00/26] block: fix " Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2022-04-15 13:18 [PATCH 00/19] " Paolo Bonzini
2022-04-15 13:18 ` [PATCH 14/26] qcow2: add missing " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922084924.201610-15-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaria@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.