qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Czenczek <hreitz@redhat.com>
To: Fabiano Rosas <farosas@suse.de>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"João Silva" <jsilva@suse.de>, "Lin Ma" <lma@suse.com>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Dario Faggioli" <dfaggioli@suse.com>,
	"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH v2 06/10] block: Convert bdrv_block_device_info into co_wrapper
Date: Mon, 6 Nov 2023 13:51:09 +0100	[thread overview]
Message-ID: <c83eaf27-87de-421f-928a-f40745a7ac25@redhat.com> (raw)
In-Reply-To: <20230609201910.12100-7-farosas@suse.de>

On 09.06.23 22:19, Fabiano Rosas wrote:
> We're converting callers of bdrv_get_allocated_file_size() to run in
> coroutines because that function will be made asynchronous when called
> (indirectly) from the QMP dispatcher.
>
> This function is a candidate because it calls bdrv_query_image_info()
> -> bdrv_do_query_node_info() -> bdrv_get_allocated_file_size().
>
> It is safe to turn this is a coroutine because the code it calls is
> made up of either simple accessors and string manipulation functions
> [1] or it has already been determined to be safe [2].
>
> 1) bdrv_refresh_filename(), bdrv_is_read_only(),
>     blk_enable_write_cache(), bdrv_cow_bs(), blk_get_public(),
>     throttle_group_get_name(), bdrv_write_threshold_get(),
>     bdrv_query_dirty_bitmaps(), throttle_group_get_config(),
>     bdrv_filter_or_cow_bs(), bdrv_skip_implicit_filters()
>
> 2) bdrv_do_query_node_info() (see previous commit);
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   block/qapi.c         |  8 ++++----
>   include/block/qapi.h | 12 ++++++++----
>   2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/block/qapi.c b/block/qapi.c
> index a2e71edaff..20660e15d6 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -41,10 +41,10 @@
>   #include "qemu/qemu-print.h"
>   #include "sysemu/block-backend.h"
>   
> -BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
> -                                        BlockDriverState *bs,
> -                                        bool flat,
> -                                        Error **errp)
> +BlockDeviceInfo *coroutine_fn bdrv_co_block_device_info(BlockBackend *blk,
> +                                                        BlockDriverState *bs,
> +                                                        bool flat,
> +                                                        Error **errp)
>   {
>       ImageInfo **p_image_info;
>       ImageInfo *backing_info;
> diff --git a/include/block/qapi.h b/include/block/qapi.h
> index 7035bcd1ae..5cb0202791 100644
> --- a/include/block/qapi.h
> +++ b/include/block/qapi.h
> @@ -30,10 +30,14 @@
>   #include "block/snapshot.h"
>   #include "qapi/qapi-types-block-core.h"
>   
> -BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
> -                                        BlockDriverState *bs,
> -                                        bool flat,
> -                                        Error **errp);
> +BlockDeviceInfo *coroutine_fn bdrv_co_block_device_info(BlockBackend *blk,
> +                                                        BlockDriverState *bs,
> +                                                        bool flat,
> +                                                        Error **errp);
> +BlockDeviceInfo *co_wrapper bdrv_block_device_info(BlockBackend *blk,
> +                                                   BlockDriverState *bs,
> +                                                   bool flat,
> +                                                   Error **errp);

bdrv_co_block_device_info() is now marked as GRAPH_RDLOCK, so should 
this use a co_wrapper_bdrv_rdlock instead?

Hanna

>   int bdrv_query_snapshot_info_list(BlockDriverState *bs,
>                                     SnapshotInfoList **p_list,
>                                     Error **errp);



  reply	other threads:[~2023-11-06 12:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 20:19 [PATCH v2 00/10] block: Make raw_co_get_allocated_file_size asynchronous Fabiano Rosas
2023-06-09 20:19 ` [PATCH v2 01/10] block: Remove bdrv_query_block_node_info Fabiano Rosas
2023-06-09 20:19 ` [PATCH v2 02/10] block: Remove unnecessary variable in bdrv_block_device_info Fabiano Rosas
2023-07-03 14:04   ` Philippe Mathieu-Daudé
2023-06-09 20:19 ` [PATCH v2 03/10] block: Allow the wrapper script to see functions declared in qapi.h Fabiano Rosas
2023-11-06 14:51   ` Hanna Czenczek
2023-06-09 20:19 ` [PATCH v2 04/10] block: Temporarily mark bdrv_co_get_allocated_file_size as mixed Fabiano Rosas
2023-11-06 14:51   ` Hanna Czenczek
2023-06-09 20:19 ` [PATCH v2 05/10] block: Convert bdrv_query_block_graph_info to coroutine Fabiano Rosas
2023-11-06 14:52   ` Hanna Czenczek
2023-06-09 20:19 ` [PATCH v2 06/10] block: Convert bdrv_block_device_info into co_wrapper Fabiano Rosas
2023-11-06 12:51   ` Hanna Czenczek [this message]
2023-06-09 20:19 ` [PATCH v2 07/10] block: Convert qmp_query_named_block_nodes to coroutine Fabiano Rosas
2023-11-06 12:51   ` Hanna Czenczek
2023-06-09 20:19 ` [PATCH v2 08/10] block: Don't query all block devices at hmp_nbd_server_start Fabiano Rosas
2023-11-06 13:07   ` Hanna Czenczek
2023-06-09 20:19 ` [PATCH v2 09/10] block: Convert qmp_query_block() to coroutine_fn Fabiano Rosas
2023-11-06 14:40   ` Hanna Czenczek
2023-11-06 15:02   ` Hanna Czenczek
2023-11-29 20:19     ` Fabiano Rosas
2023-06-09 20:19 ` [PATCH v2 10/10] block: Add a thread-pool version of fstat Fabiano Rosas
2023-11-06 14:52   ` Hanna Czenczek
2023-07-03 13:55 ` [PATCH v2 00/10] block: Make raw_co_get_allocated_file_size asynchronous Fabiano Rosas
2023-08-22 11:52 ` Claudio Fontana

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=c83eaf27-87de-421f-928a-f40745a7ac25@redhat.com \
    --to=hreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=cfontana@suse.de \
    --cc=dfaggioli@suse.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=jsilva@suse.de \
    --cc=kwolf@redhat.com \
    --cc=lma@suse.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 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).