0a122b
From bf95edfa1eee98775de7daac87304ceb50be7874 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <bf95edfa1eee98775de7daac87304ceb50be7874.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:53:11 +0100
0a122b
Subject: [PATCH 35/46] arch_init: right return for ram_save_iterate
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-36-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55719
0a122b
O-Subject: [RHEL7.0 PATCH 35/42] arch_init: right return for ram_save_iterate
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit 6cd0beda2c3c21fd7575e944764f392be7ef50c1
0a122b
Author: Lei Li <lilei@linux.vnet.ibm.com>
0a122b
Date:   Wed Sep 4 17:02:36 2013 +0800
0a122b
0a122b
    arch_init: right return for ram_save_iterate
0a122b
0a122b
    qemu_file_rate_limit() never return negative value since the refactor
0a122b
    by Commit 1964a39, this patch gets rid of the negative check for it,
0a122b
    adjust bytes_transferred and return value correspondingly in
0a122b
    ram_save_iterate().
0a122b
0a122b
    Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
0a122b
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
    Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
---
0a122b
 arch_init.c |   15 ++++++++++-----
0a122b
 1 files changed, 10 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 arch_init.c | 15 ++++++++++-----
0a122b
 1 file changed, 10 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/arch_init.c b/arch_init.c
0a122b
index 034341c..26d0374 100644
0a122b
--- a/arch_init.c
0a122b
+++ b/arch_init.c
0a122b
@@ -710,15 +710,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
0a122b
      */
0a122b
     ram_control_after_iterate(f, RAM_CONTROL_ROUND);
0a122b
 
0a122b
+    bytes_transferred += total_sent;
0a122b
+
0a122b
+    /*
0a122b
+     * Do not count these 8 bytes into total_sent, so that we can
0a122b
+     * return 0 if no page had been dirtied.
0a122b
+     */
0a122b
+    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
0a122b
+    bytes_transferred += 8;
0a122b
+
0a122b
+    ret = qemu_file_get_error(f);
0a122b
     if (ret < 0) {
0a122b
-        bytes_transferred += total_sent;
0a122b
         return ret;
0a122b
     }
0a122b
 
0a122b
-    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
0a122b
-    total_sent += 8;
0a122b
-    bytes_transferred += total_sent;
0a122b
-
0a122b
     return total_sent;
0a122b
 }
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b