Skip to contentSkip to conversation

migration: reorder code to make it symmetric

PATCH In review Wei Yang 2 participants 4 messages Feb 4, 2016 – Feb 22, 2016

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 migration: reorder code to make it symmetric

In qemu_savevm_state_complete_precopy(), it iterates on each device to add a json object and transfer related status to destination, while the order of the last two steps could be refined.

Current order:

json_start_object()
save_section_header()
vmstate_save()
json_end_object()
save_section_footer()

After the change:

json_start_object()
save_section_header()
vmstate_save()
save_section_footer()
json_end_object()

This patch reorder the code to to make it symmetric. No functional change.

---
 migration/savevm.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
migration/savevm.c +2 -3
index b9caf59..42bfab4 100644
@@ -1088,12 +1088,11 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
         json_prop_int(vmdesc, "instance_id", se->instance_id);
 
         save_section_header(f, se, QEMU_VM_SECTION_FULL);
-
         vmstate_save(f, se, vmdesc);
-
-        json_end_object(vmdesc);
         trace_savevm_section_end(se->idstr, se->section_id, 0);
         save_section_footer(f, se);
+
+        json_end_object(vmdesc);
     }
 
     if (!in_postcopy) {
Signature · 1 line
1.7.9.5
author
#1 lore raw

Hello everyone,

Is this one correct?

Quoted 48 lines · Wei Yang

In qemu_savevm_state_complete_precopy(), it iterates on each device to add a json object and transfer related status to destination, while the order of the last two steps could be refined.

Current order:

json_start_object()
save_section_header()
vmstate_save()
json_end_object()
save_section_footer()

After the change:

json_start_object()
save_section_header()
vmstate_save()
save_section_footer()
json_end_object()

This patch reorder the code to to make it symmetric. No functional change.

---
migration/savevm.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
migration/savevm.c +2 -3
index b9caf59..42bfab4 100644
@@ -1088,12 +1088,11 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
        json_prop_int(vmdesc, "instance_id", se->instance_id);
 
        save_section_header(f, se, QEMU_VM_SECTION_FULL);
-
        vmstate_save(f, se, vmdesc);
-
-        json_end_object(vmdesc);
        trace_savevm_section_end(se->idstr, se->section_id, 0);
        save_section_footer(f, se);
+
+        json_end_object(vmdesc);
    }
 
    if (!in_postcopy) {
Signature · 1 line
1.7.9.5
Signature · 2 lines
Wei Yang
Help you, Help me
author
#2 lore raw
In reply to Wei Yang

Hi, Amit

Do you like this one?

Quoted 48 lines · Wei Yang

In qemu_savevm_state_complete_precopy(), it iterates on each device to add a json object and transfer related status to destination, while the order of the last two steps could be refined.

Current order:

json_start_object()
save_section_header()
vmstate_save()
json_end_object()
save_section_footer()

After the change:

json_start_object()
save_section_header()
vmstate_save()
save_section_footer()
json_end_object()

This patch reorder the code to to make it symmetric. No functional change.

---
migration/savevm.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
migration/savevm.c +2 -3
index b9caf59..42bfab4 100644
@@ -1088,12 +1088,11 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
        json_prop_int(vmdesc, "instance_id", se->instance_id);
 
        save_section_header(f, se, QEMU_VM_SECTION_FULL);
-
        vmstate_save(f, se, vmdesc);
-
-        json_end_object(vmdesc);
        trace_savevm_section_end(se->idstr, se->section_id, 0);
        save_section_footer(f, se);
+
+        json_end_object(vmdesc);
    }
 
    if (!in_postcopy) {
Signature · 1 line
1.7.9.5
Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by on v1 1/1
#3 lore raw
In reply to Wei Yang
Quoted 20 lines · Wei Yang

In qemu_savevm_state_complete_precopy(), it iterates on each device to add a json object and transfer related status to destination, while the order of the last two steps could be refined.

Current order:

json_start_object()
save_section_header()
vmstate_save()
json_end_object()
save_section_footer()

After the change:

json_start_object()
save_section_header()
vmstate_save()
save_section_footer()
json_end_object()

Quoted 3 lines

This patch reorder the code to to make it symmetric. No functional change.

Thanks,

Amit