migration: do not nest flushing of device data
commita3fa1d78cbae2259491b17689812edcb643a3b30
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Feb 2013 16:36:18 +0000 (22 17:36 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 11 Mar 2013 12:32:01 +0000 (11 13:32 +0100)
treeb94551bf8b2a80738b46539c719ddefb17368142
parentdba433c03a0f5dc22a459435dd89557886298921
migration: do not nest flushing of device data

Completion of migration is currently done with a "nested" loop that
invokes buffered_flush: migrate_fd_completed is called by
buffered_file_thread, which calls migrate_fd_cleanup, which calls
buffered_close (via qemu_fclose), which flushes the buffer.

Simplify this, by reusing the buffered_flush call of buffered_file_thread.
Then if qemu_savevm_state_complete was called, and the buffer is empty
(including the QEMUFile buffer, for which we need the previous patch), we
are done.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration.c