From patchwork Mon Oct 24 13:27:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 121356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D90E01007D1 for ; Tue, 25 Oct 2011 00:44:41 +1100 (EST) Received: from localhost ([::1]:39061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIKaC-00036Z-RZ for incoming@patchwork.ozlabs.org; Mon, 24 Oct 2011 09:28:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIKZM-0001hn-Qa for qemu-devel@nongnu.org; Mon, 24 Oct 2011 09:28:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIKZG-0003g9-Q9 for qemu-devel@nongnu.org; Mon, 24 Oct 2011 09:28:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIKZG-0003fv-Cr for qemu-devel@nongnu.org; Mon, 24 Oct 2011 09:27:54 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9ODRUtU013597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Oct 2011 09:27:30 -0400 Received: from localhost (ovpn-113-89.phx2.redhat.com [10.3.113.89]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9ODRTFm021942; Mon, 24 Oct 2011 09:27:30 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 24 Oct 2011 11:27:01 -0200 Message-Id: <1319462832-12199-9-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1319462832-12199-1-git-send-email-lcapitulino@redhat.com> References: <1319462832-12199-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, armbru@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 08/19] block: iostatus: Drop BDRV_IOS_INVAL 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 A future commit will convert bdrv_info() to the QAPI and it won't provide IOS_INVAL. Luckily all we have to do is to add a new 'iostatus_enabled' member to BlockDriverState and use it instead. Signed-off-by: Luiz Capitulino --- block.c | 5 +++-- block.h | 3 +-- block_int.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 9873b57..04f4143 100644 --- a/block.c +++ b/block.c @@ -3079,6 +3079,7 @@ int bdrv_in_use(BlockDriverState *bs) void bdrv_iostatus_enable(BlockDriverState *bs) { + bs->iostatus_enabled = true; bs->iostatus = BDRV_IOS_OK; } @@ -3086,7 +3087,7 @@ void bdrv_iostatus_enable(BlockDriverState *bs) * enables it _and_ the VM is configured to stop on errors */ bool bdrv_iostatus_is_enabled(const BlockDriverState *bs) { - return (bs->iostatus != BDRV_IOS_INVAL && + return (bs->iostatus_enabled && (bs->on_write_error == BLOCK_ERR_STOP_ENOSPC || bs->on_write_error == BLOCK_ERR_STOP_ANY || bs->on_read_error == BLOCK_ERR_STOP_ANY)); @@ -3094,7 +3095,7 @@ bool bdrv_iostatus_is_enabled(const BlockDriverState *bs) void bdrv_iostatus_disable(BlockDriverState *bs) { - bs->iostatus = BDRV_IOS_INVAL; + bs->iostatus_enabled = false; } void bdrv_iostatus_reset(BlockDriverState *bs) diff --git a/block.h b/block.h index e77988e..9c77604 100644 --- a/block.h +++ b/block.h @@ -78,8 +78,7 @@ typedef enum { } BlockMonEventAction; typedef enum { - BDRV_IOS_INVAL, BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, - BDRV_IOS_MAX + BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, BDRV_IOS_MAX } BlockIOStatus; void bdrv_iostatus_enable(BlockDriverState *bs); diff --git a/block_int.h b/block_int.h index f2f4f2d..7ce2150 100644 --- a/block_int.h +++ b/block_int.h @@ -199,6 +199,7 @@ struct BlockDriverState { drivers. They are not used by the block driver */ int cyls, heads, secs, translation; BlockErrorAction on_read_error, on_write_error; + bool iostatus_enabled; BlockIOStatus iostatus; char device_name[32]; unsigned long *dirty_bitmap;