From patchwork Tue Aug 27 07:49:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 270052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24D422C00C5 for ; Tue, 27 Aug 2013 17:53:17 +1000 (EST) Received: from localhost ([::1]:54665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEE5T-0003OJ-4u for incoming@patchwork.ozlabs.org; Tue, 27 Aug 2013 03:53:15 -0400 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 d28dlp01.in.ibm.com (9.184.220.126) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 27 Aug 2013 13:11:59 +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 Received: from RH63Wenchao (wenchaox.cn.ibm.com [9.115.122.153]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r7R7nCJs009821; Tue, 27 Aug 2013 13:21:43 +0530 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Tue, 27 Aug 2013 15:49:24 +0800 Message-Id: <1377589765-30215-3-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 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> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13082707-9574-0000-0000-0000095A4FA2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.6 Cc: kwolf@redhat.com, pbonzini@redhat.com, Wenchao Xia , stefanha@redhat.com Subject: [Qemu-devel] [RFC PATCH 2/3] block: add function qemu_get_bds_queue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);