migration: flush all data to fd when buffered_flush is called

Including data that resided in the QEMUFile's own buffer.

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>
This commit is contained in:
Paolo Bonzini 2013-02-22 17:36:15 +01:00 committed by Juan Quintela
parent 4eb938102b
commit f5821518ed
1 changed files with 2 additions and 0 deletions

View File

@ -525,6 +525,8 @@ static ssize_t buffered_flush(MigrationState *s)
DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size); DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);
qemu_fflush(s->file);
while (s->bytes_xfer < s->xfer_limit && offset < s->buffer_size) { while (s->bytes_xfer < s->xfer_limit && offset < s->buffer_size) {
size_t to_send = MIN(s->buffer_size - offset, s->xfer_limit - s->bytes_xfer); size_t to_send = MIN(s->buffer_size - offset, s->xfer_limit - s->bytes_xfer);
ret = migrate_fd_put_buffer(s, s->buffer + offset, to_send); ret = migrate_fd_put_buffer(s, s->buffer + offset, to_send);