From: WANG Chao <wcwxyz@gmail.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] qga: use unbuffered glib IO
Date: Tue, 14 Apr 2015 10:53:07 +0800 [thread overview]
Message-ID: <1428979987-21883-1-git-send-email-wcwxyz@gmail.com> (raw)
Glib's internal buffering implementation is opaque. It seems to grow up
when receiving large chunk of data (eg. by guest-file-write). When that
buffer become large, the glib main loop will stop notifying callback for
small incoming chunk (eg. by guest-file-close) but wait until buffer is
filled up again. In this situation, qemu-ga will simply looks like
hang/dead from the client side of view.
By disabling the buffer, qemu-ga will deal with each incoming chunk with
no delay. So the client side will no longer face the situation where an
issued command doesn't come back with a response.
Signed-off-by: WANG Chao <wcwxyz@gmail.com>
---
qga/channel-posix.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 8aad4fe..a2ca161 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -116,6 +116,7 @@ static int ga_channel_client_add(GAChannel *c, int fd)
client_channel = g_io_channel_unix_new(fd);
g_assert(client_channel);
g_io_channel_set_encoding(client_channel, NULL, &err);
+ g_io_channel_set_buffered(client_channel, false);
if (err != NULL) {
g_warning("error setting channel encoding to binary");
g_error_free(err);
@@ -230,14 +231,6 @@ GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size)
size -= written;
}
- if (status == G_IO_STATUS_NORMAL) {
- status = g_io_channel_flush(c->client_channel, &err);
- if (err != NULL) {
- g_warning("error flushing channel: %s", err->message);
- return G_IO_STATUS_ERROR;
- }
- }
-
return status;
}
--
2.3.0
reply other threads:[~2015-04-14 2:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1428979987-21883-1-git-send-email-wcwxyz@gmail.com \
--to=wcwxyz@gmail.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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).