qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] cut large snapshot startup time (Vista runs in


From: Shahar Livne
Subject: Re: [Qemu-devel] [PATCH] cut large snapshot startup time (Vista runs in 5 secs)
Date: Sun, 08 Jun 2008 11:10:08 +0300
User-agent: Thunderbird 2.0.0.14 (X11/20080502)

Andrzej - thank you for the remark.

version_id increase is indeed a good way to track the change in the format, and I will be happy to implement it if the maintainers find interest in this improvement. It can also join the next version_id change, which may come from other reasons.


For my purposes, I didn't have to work with the 2 formats in parallel, as I just ran one time conversion.

The conversion was done by firing a modified qemu that read the static_ram in the old format, and wrote the static_ram back in the new format (patch attached).

The converter was started with -S, so the VM never ran. When the monitor prompt appeared, I just asked for loadvm, delvm, savevm, quit, and the image was converted. A script did this job on the 500 old images which required conversion, and that was it.

Another small remark: If the old image was saved while -usb flag in the qemu was present, it must be present also during the conversion, or else the usb related state is not saved. RAM saving depends on the current hardware.

Shahar


andrzej zaborowski wrote:
On 19/05/2008, Shahar Livne <address@hidden> wrote:
 It is important to mention that old snapshots must be converted once this
patch is applied.

Great finding, but if the snapshot format changes, you need to at
least attempt to detect old snapshots.  Qemu has an easy mechanism for
this (note the version_id parameter, just increase it).

Index: vl.c
===================================================================
--- vl.c        (revision 688)
+++ vl.c        (revision 689)
@@ -5788,6 +5788,10 @@
     return 0;
 }
 
+/* The PREV_BDRV_HASH_BLOCK_SIZE is used for converter */
+/* It can be set to the default of 1024, and then it */
+/* reads old format and writes new format */
+#define PREV_BDRV_HASH_BLOCK_SIZE 16384
 #define BDRV_HASH_BLOCK_SIZE 16384
 #define IOBUF_SIZE 4096
 #define RAM_CBLOCK_MAGIC 0xfabe
@@ -6013,7 +6017,7 @@
         return -EINVAL;
     if (ram_decompress_open(s, f) < 0)
         return -EINVAL;
-    for(i = 0; i < phys_ram_size; i+= BDRV_HASH_BLOCK_SIZE) {
+    for(i = 0; i < phys_ram_size; i+= PREV_BDRV_HASH_BLOCK_SIZE) {
 #ifdef USE_KVM
         if (kvm_allowed && (i>=0xa0000) && (i<0xc0000)) /* do not access 
video-addresses */
             continue;
@@ -6023,7 +6027,7 @@
             goto error;
         }
         if (buf[0] == 0) {
-            if (ram_decompress_buf(s, phys_ram_base + i, BDRV_HASH_BLOCK_SIZE) 
< 0) {
+            if (ram_decompress_buf(s, phys_ram_base + i, 
PREV_BDRV_HASH_BLOCK_SIZE) < 0) {
                 fprintf(stderr, "Error while reading ram block 
address=0x%08x", i);
                 goto error;
             }
@@ -6041,7 +6045,7 @@
                 goto error;
             }
             if (bdrv_read(bs_table[bs_index], sector_num, phys_ram_base + i, 
-                          BDRV_HASH_BLOCK_SIZE / 512) < 0) {
+                          PREV_BDRV_HASH_BLOCK_SIZE / 512) < 0) {
                 fprintf(stderr, "Error while reading sector %d:%" PRId64 "\n", 
                         bs_index, sector_num);
                 goto error;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]