Patchwork [RFC,2/3] block: add function qemu_get_bds_queue

login
register
mail settings
Submitter Wayne Xia
Date Aug. 27, 2013, 7:49 a.m.
Message ID <1377589765-30215-3-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/270052/
State New
Headers show

Comments

Wayne Xia - Aug. 27, 2013, 7:49 a.m.
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 <xiawenc@linux.vnet.ibm.com>
---
 block.c               |    5 +++++
 include/block/block.h |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

Patch

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);