@@ -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)
{
@@ -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);
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(-)