From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com
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 [thread overview]
Message-ID: <1353429936-29180-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1353429936-29180-1-git-send-email-pbonzini@redhat.com>
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 <pbonzini@redhat.com>
---
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
prev parent reply other threads:[~2012-11-20 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 16:45 [Qemu-devel] [PATCH v2 0/4] migration: fix rate limiting Paolo Bonzini
2012-11-20 16:45 ` [Qemu-devel] [PATCH v2 1/4] buffered_file: reset bytes_xfer on every tick Paolo Bonzini
2012-11-20 16:45 ` [Qemu-devel] [PATCH v2 2/4] buffered_file: do not send more than s->bytes_xfer bytes per tick Paolo Bonzini
2012-11-20 16:45 ` [Qemu-devel] [PATCH v2 3/4] buffered_file: rate-limit producers based on buffer size Paolo Bonzini
2012-11-24 19:53 ` Blue Swirl
2012-11-26 8:17 ` Paolo Bonzini
2012-11-20 16:45 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353429936-29180-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).