From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEE4G-00020F-QB for qemu-devel@nongnu.org; Tue, 27 Aug 2013 03:52:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEE47-0003FQ-Lc for qemu-devel@nongnu.org; Tue, 27 Aug 2013 03:52:00 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:42061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEE46-0003Ey-Tp for qemu-devel@nongnu.org; Tue, 27 Aug 2013 03:51:51 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Aug 2013 13:12:03 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 935A5E0054 for ; Tue, 27 Aug 2013 13:22:19 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7R7pfxa45220000 for ; Tue, 27 Aug 2013 13:21:41 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7R7pifl017739 for ; Tue, 27 Aug 2013 13:21:44 +0530 From: Wenchao Xia Date: Tue, 27 Aug 2013 15:49:24 +0800 Message-Id: <1377589765-30215-3-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1377589765-30215-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1377589765-30215-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH 2/3] block: add function qemu_get_bds_queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, Wenchao Xia , stefanha@redhat.com 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 --- 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