Skip to content

Commit

Permalink
QEMUFileBuffered: indicate that we're ready when the underlying file …
Browse files Browse the repository at this point in the history
…is ready

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready,
and tells its producer so.  However, when the underlying QEMUFile becomes
ready, it neglects to pass that information along, resulting in stoppage
of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered
are almost always ready, but in the case of exec: migration this is not true,
due to the small pipe buffers used to connect to the target process.  The
result is very slow migration.

Fix by detecting the readiness notification and propagating it.  The detection
is a little ugly since QEMUFile overloads put_buffer() to send it, but that's
the suject for a different patch.

Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
  • Loading branch information
avikivity authored and Anthony Liguori committed Aug 19, 2010
1 parent 9fc391f commit 5e77aaa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions buffered_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
offset = size;
}

if (pos == 0 && size == 0) {
DPRINTF("file is ready\n");
if (s->bytes_xfer <= s->xfer_limit) {
DPRINTF("notifying client\n");
s->put_ready(s->opaque);
}
}

return offset;
}

Expand Down

0 comments on commit 5e77aaa

Please sign in to comment.