[PATCH v6 22/33] block/coroutines: I/O API

Emanuele Giuseppe Esposito posted 33 patches 4 years ago
Maintainers: "Daniel P. Berrangé" <berrange@redhat.com>, Greg Kurz <groug@kaod.org>, "Cédric Le Goater" <clg@kaod.org>, Markus Armbruster <armbru@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, John Snow <jsnow@redhat.com>, Eric Blake <eblake@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Kevin Wolf <kwolf@redhat.com>, Juan Quintela <quintela@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Fam Zheng <fam@euphon.net>, "Denis V. Lunev" <den@openvz.org>, Richard Henderson <richard.henderson@linaro.org>, Daniel Henrique Barboza <danielhb413@gmail.com>
There is a newer version of this series
[PATCH v6 22/33] block/coroutines: I/O API
Posted by Emanuele Giuseppe Esposito 4 years ago
block coroutines functions run in different aiocontext, and are
not protected by the BQL. Therefore are I/O.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/coroutines.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/coroutines.h b/block/coroutines.h
index c8c14a29c8..c61abd271a 100644
--- a/block/coroutines.h
+++ b/block/coroutines.h
@@ -29,6 +29,12 @@
 
 /* For blk_bs() in generated block/block-gen.c */
 #include "sysemu/block-backend.h"
+/*
+ * I/O API functions. These functions are thread-safe.
+ *
+ * See include/block/block-io.h for more information about
+ * the I/O API.
+ */
 
 int coroutine_fn bdrv_co_check(BlockDriverState *bs,
                                BdrvCheckResult *res, BdrvCheckMode fix);
-- 
2.31.1


Re: [PATCH v6 22/33] block/coroutines: I/O API
Posted by Kevin Wolf 4 years ago
Am 21.01.2022 um 18:05 hat Emanuele Giuseppe Esposito geschrieben:
> block coroutines functions run in different aiocontext, and are
> not protected by the BQL. Therefore are I/O.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  block/coroutines.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block/coroutines.h b/block/coroutines.h
> index c8c14a29c8..c61abd271a 100644
> --- a/block/coroutines.h
> +++ b/block/coroutines.h
> @@ -29,6 +29,12 @@
>  
>  /* For blk_bs() in generated block/block-gen.c */
>  #include "sysemu/block-backend.h"
> +/*
> + * I/O API functions. These functions are thread-safe.
> + *
> + * See include/block/block-io.h for more information about
> + * the I/O API.
> + */

Please keep an empty line between #include and the rest.

As discussed in patch 2, this file will need some rearrangement.
Generally, the coroutine_fn is indeed I/O, but the generated_co_wrapper
is mixed "I/O or GS" and requires the BQL or a specific iothread.

Kevin