]> git.proxmox.com Git - qemu.git/commitdiff
arch_init: right return for ram_save_iterate
authorLei Li <lilei@linux.vnet.ibm.com>
Wed, 4 Sep 2013 09:02:36 +0000 (17:02 +0800)
committerJuan Quintela <quintela@trasno.org>
Tue, 24 Sep 2013 11:22:08 +0000 (13:22 +0200)
qemu_file_rate_limit() never return negative value since the refactor
by Commit 1964a39, this patch gets rid of the negative check for it,
adjust bytes_transferred and return value correspondingly in
ram_save_iterate().

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
arch_init.c

index e47e1399bb5fcf961c3c5d95a3bc4a7469b81842..18cd9a1f1102dc9e6617fd875a049f2072482fea 100644 (file)
@@ -710,15 +710,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
      */
     ram_control_after_iterate(f, RAM_CONTROL_ROUND);
 
+    bytes_transferred += total_sent;
+
+    /*
+     * Do not count these 8 bytes into total_sent, so that we can
+     * return 0 if no page had been dirtied.
+     */
+    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
+    bytes_transferred += 8;
+
+    ret = qemu_file_get_error(f);
     if (ret < 0) {
-        bytes_transferred += total_sent;
         return ret;
     }
 
-    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
-    total_sent += 8;
-    bytes_transferred += total_sent;
-
     return total_sent;
 }