]> git.proxmox.com Git - qemu.git/commit - block-migration.c
block-migration: fix pending() and iterate() return values
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 12 Feb 2013 09:37:15 +0000 (10:37 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 12 Feb 2013 22:26:44 +0000 (16:26 -0600)
commit6aaa9dae8059633d52ddcd0622de1a2700fc58a8
tree93ac37ecfebab58ce862c51a8550597219ef3950
parentad55ab42d494c5f4ebc5199c5c9db473b7d5fbf9
block-migration: fix pending() and iterate() return values

The return value of .save_live_pending() is the number of bytes
remaining.  This is just an estimate because we do not know how many
blocks will be dirtied by the running guest.

Currently our return value for .save_live_pending() is wrong because it
includes dirty blocks but not in-flight bdrv_aio_readv() requests or
unsent blocks.  Crucially, it also doesn't include the bulk phase where
the entire device is transferred - therefore we risk completing block
migration before all blocks have been transferred!

The return value of .save_live_iterate() is the number of bytes
transferred this iteration.  Currently we return whether there are bytes
remaining, which is incorrect.

Move the bytes remaining calculation into .save_live_pending() and
really return the number of bytes transferred this iteration in
.save_live_iterate().

Also fix the %ld format specifier which was used for a uint64_t
argument.  PRIu64 must be use to avoid warnings on 32-bit hosts.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-id: 1360661835-28663-3-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block-migration.c