{"id":810541,"url":"http://patchwork.ozlabs.org/api/patches/810541/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906115143.27451-21-quintela@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170906115143.27451-21-quintela@redhat.com>","list_archive_url":null,"date":"2017-09-06T11:51:41","name":"[v7,20/22] migration: Rename initial_bytes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"01ba18ce37e6f7f363cb3c855a224cc582a08357","submitter":{"id":2643,"url":"http://patchwork.ozlabs.org/api/people/2643/?format=json","name":"Juan Quintela","email":"quintela@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906115143.27451-21-quintela@redhat.com/mbox/","series":[{"id":1773,"url":"http://patchwork.ozlabs.org/api/series/1773/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1773","date":"2017-09-06T11:51:21","name":"Multifd","version":7,"mbox":"http://patchwork.ozlabs.org/series/1773/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810541/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810541/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=quintela@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnMb90Bx3z9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 22:00:05 +1000 (AEST)","from localhost ([::1]:35602 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpYzz-0005NN-56\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 08:00:03 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:60557)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1dpYsr-0007qb-Sg\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 07:52:42 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1dpYsp-0008FA-FS\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 07:52:41 -0400","from mx1.redhat.com ([209.132.183.28]:51744)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <quintela@redhat.com>) id 1dpYsp-0008Ef-9J\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 07:52:39 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 4D559C057FAF\n\tfor <qemu-devel@nongnu.org>; Wed,  6 Sep 2017 11:52:38 +0000 (UTC)","from secure.mitica (ovpn-117-188.ams2.redhat.com [10.36.117.188])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id EDE2C7E34E;\n\tWed,  6 Sep 2017 11:52:36 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 4D559C057FAF","From":"Juan Quintela <quintela@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Wed,  6 Sep 2017 13:51:41 +0200","Message-Id":"<20170906115143.27451-21-quintela@redhat.com>","In-Reply-To":"<20170906115143.27451-1-quintela@redhat.com>","References":"<20170906115143.27451-1-quintela@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tWed, 06 Sep 2017 11:52:38 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v7 20/22] migration: Rename initial_bytes","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Now it is called qemu_file_bytes that reflects better what it does,\nand we create qemu_file_bytes_now to not have to call qemu_ftell() twice.\n\nSigned-off-by: Juan Quintela <quintela@redhat.com>\nReviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n migration/migration.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)","diff":"diff --git a/migration/migration.c b/migration/migration.c\nindex 157e8fd1d0..62c410aac3 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -2064,13 +2064,13 @@ static void *migration_thread(void *opaque)\n     /* Used by the bandwidth calcs, updated later */\n     int64_t initial_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);\n     int64_t setup_start = qemu_clock_get_ms(QEMU_CLOCK_HOST);\n-    int64_t initial_bytes = 0;\n     /*\n      * The final stage happens when the remaining data is smaller than\n      * this threshold; it's calculated from the requested downtime and\n      * measured bandwidth\n      */\n     int64_t threshold_size = 0;\n+    int64_t qemu_file_bytes = 0;\n     int64_t start_time = initial_time;\n     int64_t end_time;\n     bool old_vm_running = false;\n@@ -2158,8 +2158,9 @@ static void *migration_thread(void *opaque)\n         }\n         current_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);\n         if (current_time >= initial_time + BUFFER_DELAY) {\n-            uint64_t transferred_bytes = qemu_ftell(s->to_dst_file) -\n-                                         initial_bytes;\n+            uint64_t qemu_file_bytes_now = qemu_ftell(s->to_dst_file);\n+            uint64_t transferred_bytes =\n+                qemu_file_bytes_now - qemu_file_bytes;\n             uint64_t time_spent = current_time - initial_time;\n             double bandwidth = (double)transferred_bytes / time_spent;\n             threshold_size = bandwidth * s->parameters.downtime_limit;\n@@ -2178,7 +2179,7 @@ static void *migration_thread(void *opaque)\n \n             qemu_file_reset_rate_limit(s->to_dst_file);\n             initial_time = current_time;\n-            initial_bytes = qemu_ftell(s->to_dst_file);\n+            qemu_file_bytes = qemu_file_bytes_now;\n         }\n         if (qemu_file_rate_limit(s->to_dst_file)) {\n             /* usleep expects microseconds */\n","prefixes":["v7","20/22"]}