From: Kevin Wolf <kwolf@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Cc: qemu-block@nongnu.org, 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, pbonzini@redhat.com
Subject: Re: [PATCH v5 01/15] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers
Date: Wed, 23 Nov 2022 17:29:33 +0100 [thread overview]
Message-ID: <Y35KbUvGsfEmT9ka@redhat.com> (raw)
In-Reply-To: <20221123114227.85757-2-eesposit@redhat.com>
Am 23.11.2022 um 12:42 hat Emanuele Giuseppe Esposito geschrieben:
> bdrv_common_block_status_above() is a g_c_w, and it is being called by
> many "wrapper" functions like bdrv_is_allocated(),
> bdrv_is_allocated_above() and bdrv_block_status_above().
>
> Because we want to eventually split the coroutine from non-coroutine
> case in g_c_w, create duplicate wrappers that take care of directly
> calling the same coroutine functions called in the g_c_w.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> block/io.c | 64 ++++++++++++++++++++++++++++++++++++++--
> include/block/block-io.h | 15 ++++++++++
> 2 files changed, 76 insertions(+), 3 deletions(-)
>
> diff --git a/block/io.c b/block/io.c
> index 38e57d1f67..1bc05c8282 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2533,6 +2533,19 @@ bdrv_co_common_block_status_above(BlockDriverState *bs,
> return ret;
> }
>
> +int coroutine_fn bdrv_co_block_status_above(BlockDriverState *bs,
> + BlockDriverState *base,
> + int64_t offset, int64_t bytes,
> + int64_t *pnum, int64_t *map,
> + BlockDriverState **file)
> +{
> + IO_CODE();
> + /* If QEMU_IN_COROUTINE() fails, use bdrv_block_status_above() */
> + QEMU_IN_COROUTINE();
This is an obvious patch order problem: The macro doesn't even exist
yet.
As I said, personally, I don't feel like putting QEMU_IN_COROUTINE()
assertions into every coroutine_fn is a useful thing to do. Static
analysis (maybe even with something vrc based in 'make check'? Paolo,
would this be realistic?) seems much preferable. But I'd like to hear
other opinions on this, too.
I feel the same way about the comment. Yes, of course, if you're not in
a coroutine, don't call the _co variant of a function, but the one
without it. But that goes without saying, doesn't it?
> + return bdrv_co_common_block_status_above(bs, base, false, true, offset,
> + bytes, pnum, map, file, NULL);
> +}
Apart from these considerations the patch looks right.
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
next prev parent reply other threads:[~2022-11-23 16:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 11:42 [PATCH v5 00/15] Still more coroutine and various fixes in block layer Emanuele Giuseppe Esposito
2022-11-23 11:42 ` [PATCH v5 01/15] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers Emanuele Giuseppe Esposito
2022-11-23 16:29 ` Kevin Wolf [this message]
2022-11-24 7:04 ` Paolo Bonzini
2022-11-23 11:42 ` [PATCH v5 02/15] block-copy: add missing coroutine_fn annotations Emanuele Giuseppe Esposito
2022-11-23 16:32 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 03/15] nbd/server.c: " Emanuele Giuseppe Esposito
2022-11-23 11:42 ` [PATCH v5 04/15] block-backend: replace bdrv_*_above with blk_*_above Emanuele Giuseppe Esposito
2022-11-23 16:42 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 05/15] block/vmdk: add missing coroutine_fn annotations Emanuele Giuseppe Esposito
2022-11-23 11:42 ` [PATCH v5 06/15] block: avoid duplicating filename string in bdrv_create Emanuele Giuseppe Esposito
2022-11-23 16:45 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 07/15] block: introduce QEMU_IN_COROUTINE macro Emanuele Giuseppe Esposito
2022-11-23 16:49 ` Kevin Wolf
2022-11-24 7:01 ` Paolo Bonzini
2022-11-23 11:42 ` [PATCH v5 08/15] block: distinguish between bdrv_create running in coroutine and not Emanuele Giuseppe Esposito
2022-11-23 16:55 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 09/15] block: bdrv_create_file is a coroutine_fn Emanuele Giuseppe Esposito
2022-11-23 16:57 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 10/15] block-coroutine-wrapper.py: introduce generated_co_wrapper_simple Emanuele Giuseppe Esposito
2022-11-23 17:07 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 11/15] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter Emanuele Giuseppe Esposito
2022-11-23 11:42 ` [PATCH v5 12/15] " Emanuele Giuseppe Esposito
2022-11-23 17:09 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 13/15] block-coroutine-wrapper.py: support also basic return types Emanuele Giuseppe Esposito
2022-11-23 17:18 ` Kevin Wolf
2022-11-23 11:42 ` [PATCH v5 14/15] block: convert bdrv_create to generated_co_wrapper_simple Emanuele Giuseppe Esposito
2022-11-23 11:42 ` [PATCH v5 15/15] block/dirty-bitmap: convert coroutine-only functions " Emanuele Giuseppe Esposito
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=Y35KbUvGsfEmT9ka@redhat.com \
--to=kwolf@redhat.com \
--cc=codyprime@gmail.com \
--cc=crosa@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=eesposit@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jsnow@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 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.