From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Hanna Reitz <hreitz@redhat.com>, John Snow <jsnow@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
Eric Blake <eblake@redhat.com>, Fam Zheng <fam@euphon.net>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V. Lunev" <den@openvz.org>, Stefan Weil <sw@weilnetz.de>,
Jeff Cody <codyprime@gmail.com>, Cleber Rosa <crosa@redhat.com>,
qemu-devel@nongnu.org,
Emanuele Giuseppe Esposito <eesposit@redhat.com>
Subject: [PATCH v7 05/14] block/vmdk: add coroutine_fn annotations
Date: Mon, 28 Nov 2022 09:23:28 -0500 [thread overview]
Message-ID: <20221128142337.657646-6-eesposit@redhat.com> (raw)
In-Reply-To: <20221128142337.657646-1-eesposit@redhat.com>
These functions end up calling bdrv_create() implemented as generated_co_wrapper
functions.
In addition, they also happen to be always called in coroutine context,
meaning all callers are coroutine_fn.
This means that the g_c_w function will enter the qemu_in_coroutine()
case and eventually suspend (or in other words call qemu_coroutine_yield()).
Therefore we can mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
block/vmdk.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 26376352b9..0c32bf2e83 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2285,10 +2285,11 @@ exit:
return ret;
}
-static int vmdk_create_extent(const char *filename, int64_t filesize,
- bool flat, bool compress, bool zeroed_grain,
- BlockBackend **pbb,
- QemuOpts *opts, Error **errp)
+static int coroutine_fn vmdk_create_extent(const char *filename,
+ int64_t filesize, bool flat,
+ bool compress, bool zeroed_grain,
+ BlockBackend **pbb,
+ QemuOpts *opts, Error **errp)
{
int ret;
BlockBackend *blk = NULL;
@@ -2366,14 +2367,14 @@ static int filename_decompose(const char *filename, char *path, char *prefix,
* non-split format.
* idx >= 1: get the n-th extent if in a split subformat
*/
-typedef BlockBackend *(*vmdk_create_extent_fn)(int64_t size,
- int idx,
- bool flat,
- bool split,
- bool compress,
- bool zeroed_grain,
- void *opaque,
- Error **errp);
+typedef BlockBackend * coroutine_fn (*vmdk_create_extent_fn)(int64_t size,
+ int idx,
+ bool flat,
+ bool split,
+ bool compress,
+ bool zeroed_grain,
+ void *opaque,
+ Error **errp);
static void vmdk_desc_add_extent(GString *desc,
const char *extent_line_fmt,
@@ -2616,7 +2617,7 @@ typedef struct {
QemuOpts *opts;
} VMDKCreateOptsData;
-static BlockBackend *vmdk_co_create_opts_cb(int64_t size, int idx,
+static BlockBackend * coroutine_fn vmdk_co_create_opts_cb(int64_t size, int idx,
bool flat, bool split, bool compress,
bool zeroed_grain, void *opaque,
Error **errp)
@@ -2768,10 +2769,11 @@ exit:
return ret;
}
-static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
- bool flat, bool split, bool compress,
- bool zeroed_grain, void *opaque,
- Error **errp)
+static BlockBackend * coroutine_fn vmdk_co_create_cb(int64_t size, int idx,
+ bool flat, bool split,
+ bool compress,
+ bool zeroed_grain,
+ void *opaque, Error **errp)
{
int ret;
BlockDriverState *bs;
--
2.31.1
next prev parent reply other threads:[~2022-11-28 14:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 14:23 [PATCH v7 00/14] Still more coroutine and various fixes in block layer Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 01/14] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 02/14] block-copy: add coroutine_fn annotations Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 03/14] nbd/server.c: " Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 04/14] block-backend: replace bdrv_*_above with blk_*_above Emanuele Giuseppe Esposito
2022-11-28 14:23 ` Emanuele Giuseppe Esposito [this message]
2022-11-28 14:23 ` [PATCH v7 06/14] block: avoid duplicating filename string in bdrv_create Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 07/14] block: distinguish between bdrv_create running in coroutine and not Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 08/14] block: bdrv_create_file is a coroutine_fn Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 09/14] block: rename generated_co_wrapper in co_wrapper_mixed Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 10/14] block-coroutine-wrapper.py: introduce co_wrapper Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 11/14] block-coroutine-wrapper.py: support functions without bs arg Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 12/14] block-coroutine-wrapper.py: support also basic return types Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 13/14] block: convert bdrv_create to co_wrapper Emanuele Giuseppe Esposito
2022-11-28 14:23 ` [PATCH v7 14/14] block/dirty-bitmap: convert coroutine-only functions " Emanuele Giuseppe Esposito
2022-12-01 13:58 ` [PATCH v7 00/14] Still more coroutine and various fixes in block layer Kevin Wolf
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=20221128142337.657646-6-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=codyprime@gmail.com \
--cc=crosa@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
--cc=vsementsov@yandex-team.ru \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).