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 <eespo...@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