From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKNte-0006sY-Ju for qemu-devel@nongnu.org; Mon, 12 Jun 2017 07:52:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKNtb-0001ga-IU for qemu-devel@nongnu.org; Mon, 12 Jun 2017 07:52:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dKNtb-0001gM-A4 for qemu-devel@nongnu.org; Mon, 12 Jun 2017 07:52:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4658C19D24B for ; Mon, 12 Jun 2017 11:52:34 +0000 (UTC) Date: Mon, 12 Jun 2017 12:52:27 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20170612115227.GD3146@work-vm> References: <20170607105810.3003-1-quintela@redhat.com> <20170607105810.3003-2-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170607105810.3003-2-quintela@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/2] ram: Print block stats also in the complete case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org, lvivier@redhat.com, peterx@redhat.com * Juan Quintela (quintela@redhat.com) wrote: > Once there, create populate_disk_info. > > Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert > > -- > > - create populate_disk_info instead of "abusing" populate_ram_info > --- > migration/migration.c | 31 +++++++++++++------------------ > 1 file changed, 13 insertions(+), 18 deletions(-) > > diff --git a/migration/migration.c b/migration/migration.c > index 4dbc4f2..cfa266b 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -515,6 +515,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) > } > } > > +static void populate_disk_info(MigrationInfo *info) > +{ > + if (blk_mig_active()) { > + info->has_disk = true; > + info->disk = g_malloc0(sizeof(*info->disk)); > + info->disk->transferred = blk_mig_bytes_transferred(); > + info->disk->remaining = blk_mig_bytes_remaining(); > + info->disk->total = blk_mig_bytes_total(); > + } > +} > + > MigrationInfo *qmp_query_migrate(Error **errp) > { > MigrationInfo *info = g_malloc0(sizeof(*info)); > @@ -540,15 +551,7 @@ MigrationInfo *qmp_query_migrate(Error **errp) > info->setup_time = s->setup_time; > > populate_ram_info(info, s); > - > - if (blk_mig_active()) { > - info->has_disk = true; > - info->disk = g_malloc0(sizeof(*info->disk)); > - info->disk->transferred = blk_mig_bytes_transferred(); > - info->disk->remaining = blk_mig_bytes_remaining(); > - info->disk->total = blk_mig_bytes_total(); > - } > - > + populate_disk_info(info); > break; > case MIGRATION_STATUS_POSTCOPY_ACTIVE: > /* Mostly the same as active; TODO add some postcopy stats */ > @@ -562,15 +565,7 @@ MigrationInfo *qmp_query_migrate(Error **errp) > info->setup_time = s->setup_time; > > populate_ram_info(info, s); > - > - if (blk_mig_active()) { > - info->has_disk = true; > - info->disk = g_malloc0(sizeof(*info->disk)); > - info->disk->transferred = blk_mig_bytes_transferred(); > - info->disk->remaining = blk_mig_bytes_remaining(); > - info->disk->total = blk_mig_bytes_total(); > - } > - > + populate_disk_info(info); > break; > case MIGRATION_STATUS_COLO: > info->has_status = true; > -- > 2.9.4 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK