diff mbox series

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

Message ID 20211012084906.2060507-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. 12, 2021, 8:48 a.m. UTC
blockdev functions run always under the BQL lock.

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

Comments

Paolo Bonzini Oct. 12, 2021, 11:07 a.m. UTC | #1
On 12/10/21 10:48, Emanuele Giuseppe Esposito wrote:
> +/* Common functions that are neither I/O nor Global State */
> +
> +DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
> +int drive_get_max_devs(BlockInterfaceType type);
> +

blk_legacy_dinfo should count as global state (blk->legacy_dinfo is 
protected by BQL).

Paolo
diff mbox series

Patch

diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 960b54d320..cc9dfb5181 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -40,7 +40,13 @@  struct DriveInfo {
     QTAILQ_ENTRY(DriveInfo) next;
 };
 
-DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
+/*
+ * 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.
+ */
+
 DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
 BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
 
@@ -50,10 +56,14 @@  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 */
+
+DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
+int drive_get_max_devs(BlockInterfaceType type);
+
 #endif