From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxcX-0001lT-1q for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQxcQ-0006nQ-Ri for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxcQ-0006n8-Hk for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:22 -0400 From: Kevin Wolf Date: Wed, 24 Oct 2012 11:50:44 +0200 Message-Id: <1351072256-6112-21-git-send-email-kwolf@redhat.com> In-Reply-To: <1351072256-6112-1-git-send-email-kwolf@redhat.com> References: <1351072256-6112-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 20/32] block: export dirty bitmap information in query-block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Paolo Bonzini Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- block.c | 7 +++++++ qapi-schema.json | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 2c3d3da..ad5e240 100644 --- a/block.c +++ b/block.c @@ -2837,6 +2837,13 @@ BlockInfo *bdrv_query_info(BlockDriverState *bs) info->io_status = bs->iostatus; } + if (bs->dirty_bitmap) { + info->has_dirty = true; + info->dirty = g_malloc0(sizeof(*info->dirty)); + info->dirty->count = bdrv_get_dirty_count(bs) * + BDRV_SECTORS_PER_DIRTY_CHUNK * BDRV_SECTOR_SIZE; + } + if (bs->drv) { info->has_inserted = true; info->inserted = g_malloc0(sizeof(*info->inserted)); diff --git a/qapi-schema.json b/qapi-schema.json index 36278cc..dfcbb67 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -661,6 +661,18 @@ { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] } ## +# @BlockDirtyInfo: +# +# Block dirty bitmap information. +# +# @count: number of dirty bytes according to the dirty bitmap +# +# Since: 1.3 +## +{ 'type': 'BlockDirtyInfo', + 'data': {'count': 'int'} } + +## # @BlockInfo: # # Block device information. This structure describes a virtual device and @@ -679,6 +691,9 @@ # @tray_open: #optional True if the device has a tray and it is open # (only present if removable is true) # +# @dirty: #optional dirty bitmap information (only present if the dirty +# bitmap is enabled) +# # @io-status: #optional @BlockDeviceIoStatus. Only present if the device # supports it and the VM is configured to stop on errors # @@ -690,7 +705,8 @@ { 'type': 'BlockInfo', 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', 'locked': 'bool', '*inserted': 'BlockDeviceInfo', - '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus'} } + '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', + '*dirty': 'BlockDirtyInfo' } } ## # @query-block: -- 1.7.6.5