aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-07-07 19:44:22 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2010-10-11 18:20:52 -0500
commitcb03355a26a09bae91a8e5dea51538c9cccc838b (patch)
treead55fcc05d58adc25fec44a2fd56b5b8bc58f62a
parentddfe317152193e70a996d9447d5bf2507d52c662 (diff)
QEMUFileBuffered: indicate that we're ready when the underlying file 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 <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 5e77aaa0d7d2f4ceaa4fcaf50f3a26d5150f34a6)
-rw-r--r--buffered_file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/buffered_file.c b/buffered_file.c
index 54dc6c29b..a79264f45 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -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;
}