]> git.proxmox.com Git - qemu.git/commitdiff
Sort RAMBlocks by ID for migration, not by ram_addr
authorAvi Kivity <avi@redhat.com>
Wed, 21 Dec 2011 11:22:16 +0000 (13:22 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 4 Jan 2012 11:34:48 +0000 (13:34 +0200)
ram_addr is (a) unstable (b) going away.  Sort by idstr instead.

Commit b2e0a138e initially introduced the sorting for the purpose
of improving debuggability.  After this patch, the order is still
stable, but perhaps less usable by a human.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch_init.c

index c73fa1b2cb97ab276d73713b4f6643a06433cec5..5df84048a29b0bb475c562c3dcd4e57e42553008 100644 (file)
@@ -217,12 +217,8 @@ static int block_compar(const void *a, const void *b)
 {
     RAMBlock * const *ablock = a;
     RAMBlock * const *bblock = b;
-    if ((*ablock)->offset < (*bblock)->offset) {
-        return -1;
-    } else if ((*ablock)->offset > (*bblock)->offset) {
-        return 1;
-    }
-    return 0;
+
+    return strcmp((*ablock)->idstr, (*bblock)->idstr);
 }
 
 static void sort_ram_list(void)