diff mbox

[3/3,v2] arch_init: right return for ram_save_iterate

Message ID 1377509368-24921-3-git-send-email-lilei@linux.vnet.ibm.com
State New
Headers show

Commit Message

Lei Li Aug. 26, 2013, 9:29 a.m. UTC
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---

Change since v1:
  Return fixes and improvement from Paolo Bonzini.
  
 arch_init.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

Comments

Lei Li Aug. 29, 2013, 9:07 a.m. UTC | #1
Hi,

I have tested this series of changes, PING?

On 08/26/2013 05:29 PM, Lei Li wrote:
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>
> Change since v1:
>    Return fixes and improvement from Paolo Bonzini.
>    
>   arch_init.c |   15 ++++++++++-----
>   1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 94d45e1..a26bc89 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -709,15 +709,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;
>   }
>
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 94d45e1..a26bc89 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -709,15 +709,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;
 }