]> xenbits.xensource.com Git - qemu-xen-4.6-testing.git/commitdiff
qemu-xen: disable buffering on the save file for stubdoms xen-4.1.0-rc2 xen-4.1.0-rc3
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 21 Jan 2011 18:01:53 +0000 (18:01 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 21 Jan 2011 18:01:53 +0000 (18:01 +0000)
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.

[This is pretty horrid; hopefully there will be better solution for 4.2 -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
savevm.c

index b66f7e27134b6c743de8eae8b99a8941dcacf158..71a57ebac5a58380ddca8c3986018ebbadf524ce 100644 (file)
--- 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"))