aboutsummaryrefslogtreecommitdiff
path: root/block-migration.c
diff options
context:
space:
mode:
authorGary R Hook <gary.hook@nimboxx.com>2014-11-25 17:30:02 -0600
committerMichael Roth <mdroth@linux.vnet.ibm.com>2015-01-14 17:08:42 -0600
commit21640bf6e08e4d69bab1bd1ea0bed562d1fc726c (patch)
treea260f93153e25964f99beff774175cd4efe8aa17 /block-migration.c
parent6bbb939a8061d189bf29aa2b3ef1a5717380f41a (diff)
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 <gary.hook@nimboxx.com> Reviewed-by: ChenLiang <chenliang88@huawei.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1416958202-15913-1-git-send-email-gary.hook@nimboxx.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> (cherry picked from commit ebd9fbd7e102c533143c2c8372312b75c2b2678a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'block-migration.c')
-rw-r--r--block-migration.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/block-migration.c b/block-migration.c
index 73cdd07e8c..2bb98d826e 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -652,6 +652,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);
@@ -701,7 +702,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. */