qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 2/3] block: add function qemu_get_bds_queue


From: Wenchao Xia
Subject: [Qemu-devel] [RFC PATCH 2/3] block: add function qemu_get_bds_queue
Date: Tue, 27 Aug 2013 15:49:24 +0800

It should be caller's responsibility to tell which bds* needs take
action in multithread case, but since now only one thread exist
and only one bds* group exist, add this function to manage the
bds* queue temporarily. Once the block layer user code manage
the bds* queue by itself and global bdrv_states is moved out,
this function can be removed.

Signed-off-by: Wenchao Xia <address@hidden>
---
 block.c               |    5 +++++
 include/block/block.h |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index 9db3c32..bf35b90 100644
--- a/block.c
+++ b/block.c
@@ -102,6 +102,11 @@ static QLIST_HEAD(, BlockDriver) bdrv_drivers =
 /* If non-zero, use only whitelisted block drivers */
 static int use_bdrv_whitelist;
 
+BlockDrvierStateQueue *qemu_get_bds_queue(void)
+{
+    return &bdrv_states;
+}
+
 #ifdef _WIN32
 static int is_windows_drive_prefix(const char *filename)
 {
diff --git a/include/block/block.h b/include/block/block.h
index b0d4f2b..323a732 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -95,6 +95,9 @@ typedef struct BDRVReopenState {
     void *opaque;
 } BDRVReopenState;
 
+/* This function could be removed when block layer is thread safe. Then let
+   caller manage the bds it used, instead of block layer. */
+BlockDrvierStateQueue *qemu_get_bds_queue(void);
 
 void bdrv_iostatus_enable(BlockDriverState *bs);
 void bdrv_iostatus_reset(BlockDriverState *bs);
-- 
1.7.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]