[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 4/4] buffered_file: do not automatically unfreeze
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 4/4] buffered_file: do not automatically unfreeze output on buffered_put_buffer |
Date: |
Tue, 20 Nov 2012 17:45:36 +0100 |
Only unfreeze if the call comes from migrate_fd_put_notify.
If the output if frozen we can still add to the buffer (which
will not grow in an unbounded manner anyway, both with and
without the previous patch), but we will not try to flush until the
socket becomes writable.
Signed-off-by: Paolo Bonzini <address@hidden>
---
buffered_file.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/buffered_file.c b/buffered_file.c
index 2dac99a..862aa8d 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -109,14 +109,18 @@ static int buffered_put_buffer(void *opaque, const
uint8_t *buf, int64_t pos, in
return error;
}
- DPRINTF("unfreezing output\n");
- s->freeze_output = 0;
-
if (size > 0) {
DPRINTF("buffering %d bytes\n", size - offset);
buffered_append(s, buf, size);
}
+ if (pos == 0 && size == 0) {
+ DPRINTF("unfreezing output\n");
+ s->freeze_output = 0;
+ } else if (s->freeze_output) {
+ return size;
+ }
+
error = buffered_flush(s);
if (error < 0) {
DPRINTF("buffered flush error. bailing: %s\n", strerror(-error));
--
1.7.1