Il 23/08/2013 15:30, Lei Li ha scritto:
> -    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;
> +    return qemu_file_get_error(f);

No, this will never make ram_save_iterate (and thus
qemu_savevm_state_iterate) return a positive, non-zero value.  Thus:

    ret = qemu_file_get_error(f);
    if (ret < 0) {
        return ret;
    }
    return total_sent;

If you look at the code, you can see that it never returns zero.
Probably it should do something like

    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;

and then proceed as above with "ret = qemu_file_get_error(f)".

Paolo

Reply via email to