From patchwork Thu Oct 18 14:49:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 192353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6FB172C0096 for ; Fri, 19 Oct 2012 02:30:50 +1100 (EST) Received: from localhost ([::1]:50860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrR6-0007wM-3k for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2012 10:51:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrQb-0007Rs-FK for qemu-devel@nongnu.org; Thu, 18 Oct 2012 10:50:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOrQS-0007oA-TC for qemu-devel@nongnu.org; Thu, 18 Oct 2012 10:50:29 -0400 Received: from mail-da0-f45.google.com ([209.85.210.45]:57775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrQS-0007mI-Lp for qemu-devel@nongnu.org; Thu, 18 Oct 2012 10:50:20 -0400 Received: by mail-da0-f45.google.com with SMTP id n15so3522376dad.4 for ; Thu, 18 Oct 2012 07:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=QpUvYx/7tmtZZLeTVvSK2bGGHo5nP0mE1MZok8KMedg=; b=CbBL4yin+kXfS2ORWyBDv+NolXxu/0rw4R6sAED/q1ak6mwwu/0kytzUebKVfGWX7N Bhwvxv6fv0EVv7vtfaubMfBVwRZpsEH50YEtkMX28Dqe2eUvgYhOI9viIOOYd9e1V/To nh66t1okfwCzuEXbxICpENvI2YlRiq7xOJWdYDKNLaHprG2/n+8y88xo8Aqbzk7YrGsW i/UkYa4ejVpCVup1eeu7YwfmXzuEUquEY+IAMbLZ3AdOWL1KgAvor6+2fhRtk3TuCGrz gk/vRsVt+ZOCgqB8URhvIJCM6NFEQGu4tqFDJmC98gVJF3lft60LXUfEu2rCxI4onDu0 HoWA== Received: by 10.68.138.229 with SMTP id qt5mr65785781pbb.122.1350571820093; Thu, 18 Oct 2012 07:50:20 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id qb2sm14348236pbb.15.2012.10.18.07.50.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 07:50:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2012 16:49:19 +0200 Message-Id: <1350571770-9836-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1350571770-9836-1-git-send-email-pbonzini@redhat.com> References: <1350571770-9836-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.45 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH v3 05/16] block: export dirty bitmap information in query-block 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 Signed-off-by: Paolo Bonzini --- v2->v3: unit of measure is now bytes block.c | 7 +++++++ qapi-schema.json | 20 ++++++++++++++++++-- 2 file modificati, 25 inserzioni(+), 2 rimozioni(-) diff --git a/block.c b/block.c index 057b2b2..b167f61 100644 --- a/block.c +++ b/block.c @@ -2835,6 +2835,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 f9dbdae..2aac6b8 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -629,7 +629,7 @@ '*backing_file': 'str', 'backing_file_depth': 'int', 'encrypted': 'bool', 'encryption_key_missing': 'bool', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', - 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} } + 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int' } } ## # @BlockDeviceIoStatus: @@ -647,6 +647,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 @@ -665,6 +677,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 # @@ -676,7 +691,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: