[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] Block migration: fix return value
From: |
ChenLiang |
Subject: |
Re: [Qemu-devel] [PATCH v2] Block migration: fix return value |
Date: |
Wed, 26 Nov 2014 09:55:55 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
On 2014/11/26 7:30, address@hidden wrote:
> From: Gary R Hook <address@hidden>
>
> Modify block_save_iterate() to return positive/zero/negative
> (success/not done/failure) return status. The computation of
> the blocks transferred (an int64_t) exceeds the size of an
> int return value.
>
> Signed-off-by: Gary R Hook <address@hidden>
>
> ---
> block-migration.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/block-migration.c b/block-migration.c
> index 08db01a..74d9eb1 100644
> --- a/block-migration.c
> +++ b/block-migration.c
> @@ -653,6 +653,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
> {
> int ret;
> int64_t last_ftell = qemu_ftell(f);
> + int64_t delta_ftell;
>
> DPRINTF("Enter save live iterate submitted %d transferred %d\n",
> block_mig_state.submitted, block_mig_state.transferred);
> @@ -702,7 +703,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
> }
>
> qemu_put_be64(f, BLK_MIG_FLAG_EOS);
> - return qemu_ftell(f) - last_ftell;
> + delta_ftell = qemu_ftell(f) - last_ftell;
> + if (delta_ftell > 0) {
> + return 1;
> + } else if (delta_ftell < 0) {
> + return -1;
> + } else {
> + return 0;
> + }
> }
>
> /* Called with iothread lock taken. */
Reviewed-by: ChenLiang <address@hidden>