diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-11-20 12:48:19 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-12-20 22:44:29 +0100 |
commit | bde54c08b4854aceee3dee25121a2b835cb81166 (patch) | |
tree | da05647ab609f49616c0dbd73778356a04e3819f | |
parent | 244eaa7514a944b36273eb8428f32da8e9124fcf (diff) |
buffered_file: do not send more than s->bytes_xfer bytes per tick
Sending more was possible if the buffer was large.
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r-- | buffered_file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/buffered_file.c b/buffered_file.c index 27627a1b71..1de47e04a8 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -65,9 +65,9 @@ static ssize_t buffered_flush(QEMUFileBuffered *s) DPRINTF("flushing %zu byte(s) of data\n", 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); ret = migrate_fd_put_buffer(s->migration_state, s->buffer + offset, - s->buffer_size - offset); + to_send); if (ret == -EAGAIN) { DPRINTF("backend not ready, freezing\n"); ret = 0; |