[PATCH v2 5/8] block: add a few more notes on locking

Emanuele Giuseppe Esposito posted 8 patches 4 years, 9 months ago
Maintainers: Markus Armbruster <armbru@redhat.com>, Xie Changlong <xiechanglong.d@gmail.com>, John Snow <jsnow@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Wen Congyang <wencongyang2@huawei.com>, Fam Zheng <fam@euphon.net>
[PATCH v2 5/8] block: add a few more notes on locking
Posted by Emanuele Giuseppe Esposito 4 years, 9 months ago
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 include/block/block_int.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/block/block_int.h b/include/block/block_int.h
index a1aad5ad2d..67a0777e12 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -154,7 +154,9 @@ struct BlockDriver {
      */
     bool supports_backing;
 
-    /* For handling image reopen for split or non-split files */
+    /* For handling image reopen for split or non-split files.  Called
+     * with no I/O pending.
+     */
     int (*bdrv_reopen_prepare)(BDRVReopenState *reopen_state,
                                BlockReopenQueue *queue, Error **errp);
     void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
@@ -168,6 +170,7 @@ struct BlockDriver {
     /* Protocol drivers should implement this instead of bdrv_open */
     int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags,
                           Error **errp);
+    /* Called from main thread.  */
     void (*bdrv_close)(BlockDriverState *bs);
 
 
-- 
2.30.2


Re: [PATCH v2 5/8] block: add a few more notes on locking
Posted by Stefan Hajnoczi 4 years, 9 months ago
On Mon, Apr 19, 2021 at 10:55:38AM +0200, Emanuele Giuseppe Esposito wrote:
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/block/block_int.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index a1aad5ad2d..67a0777e12 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -154,7 +154,9 @@ struct BlockDriver {
>       */
>      bool supports_backing;
>  
> -    /* For handling image reopen for split or non-split files */
> +    /* For handling image reopen for split or non-split files.  Called
> +     * with no I/O pending.

Does "Called with no I/O pending" mean "Called in a drained section"?

> +     */
>      int (*bdrv_reopen_prepare)(BDRVReopenState *reopen_state,
>                                 BlockReopenQueue *queue, Error **errp);
>      void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
> @@ -168,6 +170,7 @@ struct BlockDriver {
>      /* Protocol drivers should implement this instead of bdrv_open */
>      int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags,
>                            Error **errp);
> +    /* Called from main thread.  */
>      void (*bdrv_close)(BlockDriverState *bs);
>  
>  
> -- 
> 2.30.2
>