qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 09/33] block: introduce assert_bdrv_graph_writable


From: Kevin Wolf
Subject: Re: [PATCH v6 09/33] block: introduce assert_bdrv_graph_writable
Date: Mon, 7 Feb 2022 18:14:37 +0100

Am 21.01.2022 um 18:05 hat Emanuele Giuseppe Esposito geschrieben:
> We want to be sure that the functions that write the child and
> parent list of a bs are under BQL and drain.
> 
> BQL prevents from concurrent writings from the GS API, while
> drains protect from I/O.
> 
> TODO: drains are missing in some functions using this assert.
> Therefore a proper assertion will fail. Because adding drains
> requires additional discussions, they will be added in future
> series.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

> diff --git a/block/io.c b/block/io.c
> index cb095deeec..3be08cad29 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -734,6 +734,17 @@ void bdrv_drain_all(void)
>      bdrv_drain_all_end();
>  }
>  
> +void assert_bdrv_graph_writable(BlockDriverState *bs)
> +{
> +    /*
> +     * TODO: this function is incomplete. Because the users of this
> +     * assert lack the necessary drains, check only for BQL.
> +     * Once the necessary drains are added,
> +     * assert also for qatomic_read(&bs->quiesce_counter) > 0
> +     */
> +    assert(qemu_in_main_thread());
> +}

This looks like a trivial function that could easily be static inline.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]