diff mbox series

[v4,14/25] include/systemu/blockdev.h: global state API

Message ID 20211025101735.2060852-15-eesposit@redhat.com (mailing list archive)
State New, archived
Headers show
Series block layer: split block APIs in global state and I/O | expand

Commit Message

Emanuele Giuseppe Esposito Oct. 25, 2021, 10:17 a.m. UTC
blockdev functions run always under the BQL lock.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 include/sysemu/blockdev.h | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Comments

Stefan Hajnoczi Oct. 28, 2021, 3:48 p.m. UTC | #1
On Mon, Oct 25, 2021 at 06:17:24AM -0400, Emanuele Giuseppe Esposito wrote:
> blockdev functions run always under the BQL lock.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/sysemu/blockdev.h | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Hanna Czenczek Nov. 12, 2021, 3:46 p.m. UTC | #2
Subject: s/systemu/sysemu/

On 25.10.21 12:17, Emanuele Giuseppe Esposito wrote:
> blockdev functions run always under the BQL lock.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>   include/sysemu/blockdev.h | 18 ++++++++++++++----
>   1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
> index 960b54d320..b07f15df09 100644
> --- a/include/sysemu/blockdev.h
> +++ b/include/sysemu/blockdev.h
> @@ -13,9 +13,6 @@
>   #include "block/block.h"
>   #include "qemu/queue.h"
>   
> -void blockdev_mark_auto_del(BlockBackend *blk);
> -void blockdev_auto_del(BlockBackend *blk);
> -
>   typedef enum {
>       IF_DEFAULT = -1,            /* for use with drive_add() only */
>       /*
> @@ -40,6 +37,16 @@ struct DriveInfo {
>       QTAILQ_ENTRY(DriveInfo) next;
>   };
>   
> +/*
> + * Global state (GS) API. These functions run under the BQL lock.
> + *
> + * See include/block/block-global-state.h for more information about
> + * the GS API.
> + */
> +
> +void blockdev_mark_auto_del(BlockBackend *blk);
> +void blockdev_auto_del(BlockBackend *blk);
> +
>   DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
>   DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
>   BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
> @@ -50,10 +57,13 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
>   void drive_check_orphaned(void);
>   DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
>   int drive_get_max_bus(BlockInterfaceType type);
> -int drive_get_max_devs(BlockInterfaceType type);
>   DriveInfo *drive_get_next(BlockInterfaceType type);
>   
>   DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type,
>                        Error **errp);
>   
> +/* Common functions that are neither I/O nor Global State */
> +
> +int drive_get_max_devs(BlockInterfaceType type);
> +

It seems to me like this function is never used and could just be 
dropped.  In any case, if it were used, it looks to me like it’d be used 
in a GS context.  (Not that I know anything about it, but I don’t see 
what makes it different from the other functions here.)

Hanna
diff mbox series

Patch

diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 960b54d320..b07f15df09 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -13,9 +13,6 @@ 
 #include "block/block.h"
 #include "qemu/queue.h"
 
-void blockdev_mark_auto_del(BlockBackend *blk);
-void blockdev_auto_del(BlockBackend *blk);
-
 typedef enum {
     IF_DEFAULT = -1,            /* for use with drive_add() only */
     /*
@@ -40,6 +37,16 @@  struct DriveInfo {
     QTAILQ_ENTRY(DriveInfo) next;
 };
 
+/*
+ * Global state (GS) API. These functions run under the BQL lock.
+ *
+ * See include/block/block-global-state.h for more information about
+ * the GS API.
+ */
+
+void blockdev_mark_auto_del(BlockBackend *blk);
+void blockdev_auto_del(BlockBackend *blk);
+
 DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
 DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
 BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
@@ -50,10 +57,13 @@  DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
 void drive_check_orphaned(void);
 DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
 int drive_get_max_bus(BlockInterfaceType type);
-int drive_get_max_devs(BlockInterfaceType type);
 DriveInfo *drive_get_next(BlockInterfaceType type);
 
 DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type,
                      Error **errp);
 
+/* Common functions that are neither I/O nor Global State */
+
+int drive_get_max_devs(BlockInterfaceType type);
+
 #endif