Skip to content

Commit 21640bf

Browse files
Gary R Hookmdroth
authored andcommitted
block migration: fix return value
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 <[email protected]> Reviewed-by: ChenLiang <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Message-id: [email protected] Signed-off-by: Stefan Hajnoczi <[email protected]> (cherry picked from commit ebd9fbd) Signed-off-by: Michael Roth <[email protected]>
1 parent 6bbb939 commit 21640bf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

block-migration.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
652652
{
653653
int ret;
654654
int64_t last_ftell = qemu_ftell(f);
655+
int64_t delta_ftell;
655656

656657
DPRINTF("Enter save live iterate submitted %d transferred %d\n",
657658
block_mig_state.submitted, block_mig_state.transferred);
@@ -701,7 +702,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
701702
}
702703

703704
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
704-
return qemu_ftell(f) - last_ftell;
705+
delta_ftell = qemu_ftell(f) - last_ftell;
706+
if (delta_ftell > 0) {
707+
return 1;
708+
} else if (delta_ftell < 0) {
709+
return -1;
710+
} else {
711+
return 0;
712+
}
705713
}
706714

707715
/* Called with iothread lock taken. */

0 commit comments

Comments
 (0)