WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3/5] qemu-xen: disable buffering on the save file for

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/5] qemu-xen: disable buffering on the save file for stubdoms
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 19 Jan 2011 13:53:24 +0000
Delivery-date: Wed, 19 Jan 2011 05:55:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
We need to issue reads with the exact number of bytes to read the
qemu-xen save file, and to do that this patch disables buffering on all
the savevm reads/writes for stubdoms.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff --git a/savevm.c b/savevm.c
index b66f7e2..71a57eb 100644
--- a/savevm.c
+++ b/savevm.c
@@ -133,7 +133,13 @@ void qemu_announce_self(void)
 /***********************************************************/
 /* savevm/loadvm support */
 
+#ifdef CONFIG_STUBDOM
+/* disable buffering for stubdoms because we need to issue reads for the
+ * exact number of bytes */
+#define IO_BUF_SIZE 1
+#else
 #define IO_BUF_SIZE 32768
+#endif
 
 struct QEMUFile {
     QEMUFilePutBufferFunc *put_buffer;
@@ -303,6 +309,10 @@ QEMUFile *qemu_fopen(const char *filename, const char 
*mode)
     if (!s->outfile)
         goto fail;
 
+#ifdef CONFIG_STUBDOM
+    setvbuf(s->outfile, NULL, _IONBF, 0);
+#endif
+
     if (!strcmp(mode, "wb"))
         return qemu_fopen_ops(s, file_put_buffer, NULL, file_close, NULL);
     else if (!strcmp(mode, "rb"))

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>