{"id":813372,"url":"http://patchwork.ozlabs.org/api/patches/813372/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913105953.13760-19-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":"<20170913105953.13760-19-quintela@redhat.com>","list_archive_url":null,"date":"2017-09-13T10:59:51","name":"[v8,18/20] 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/20170913105953.13760-19-quintela@redhat.com/mbox/","series":[{"id":2885,"url":"http://patchwork.ozlabs.org/api/series/2885/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2885","date":"2017-09-13T10:59:33","name":"Multifd","version":8,"mbox":"http://patchwork.ozlabs.org/series/2885/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813372/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813372/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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.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 3xsfKS0GNQz9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 21:18:04 +1000 (AEST)","from localhost ([::1]:41637 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 1ds5gA-0005ft-6q\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 07:18:02 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:42512)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1ds5Pa-0006gt-1Y\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 07:00:59 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1ds5PU-00075e-Iy\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 07:00:54 -0400","from mx1.redhat.com ([209.132.183.28]:44160)\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 1ds5PU-000757-Bb\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 07:00:48 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 57E42C04B944\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Sep 2017 11:00:47 +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 BDE9E61786;\n\tWed, 13 Sep 2017 11:00:45 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 57E42C04B944","From":"Juan Quintela <quintela@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Wed, 13 Sep 2017 12:59:51 +0200","Message-Id":"<20170913105953.13760-19-quintela@redhat.com>","In-Reply-To":"<20170913105953.13760-1-quintela@redhat.com>","References":"<20170913105953.13760-1-quintela@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tWed, 13 Sep 2017 11:00:47 +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 v8 18/20] 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 674c254c3f..67f3375ddc 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -2065,13 +2065,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@@ -2159,8 +2159,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@@ -2179,7 +2180,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":["v8","18/20"]}