[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 41/42] migration: Trivial cleanup on JSON writer of vmstate_save()
From: |
Fabiano Rosas |
Subject: |
[PULL 41/42] migration: Trivial cleanup on JSON writer of vmstate_save() |
Date: |
Wed, 29 Jan 2025 13:00:58 -0300 |
From: Peter Xu <peterx@redhat.com>
Two small cleanups in the same section of vmstate_save():
- Check vmdesc before the "mixed null/non-null data in array" logic, to
be crystal clear that it's only about the JSON writer, not the vmstate on
its own in the migration stream.
- Since we have is_null variable now, use that to replace a check.
Signed-off-by: Peter Xu <peterx@redhat.com>
Tested-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Link: 20250114230746.3268797-17-peterx@redhat.com">https://lore.kernel.org/r/20250114230746.3268797-17-peterx@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/vmstate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 82bd005a83..047a52af89 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -459,6 +459,8 @@ int vmstate_save_state_v(QEMUFile *f, const
VMStateDescription *vmsd,
}
/*
+ * This logic only matters when dumping VM Desc.
+ *
* Due to the fake nullptr handling above, if there's mixed
* null/non-null data, it doesn't make sense to emit a
* compressed array representation spanning the entire array
@@ -466,7 +468,7 @@ int vmstate_save_state_v(QEMUFile *f, const
VMStateDescription *vmsd,
* vs. nullptr). Search ahead for the next null/non-null
element
* and start a new compressed array if found.
*/
- if (field->flags & VMS_ARRAY_OF_POINTER &&
+ if (vmdesc && (field->flags & VMS_ARRAY_OF_POINTER) &&
is_null != is_prev_null) {
is_prev_null = is_null;
@@ -504,7 +506,7 @@ int vmstate_save_state_v(QEMUFile *f, const
VMStateDescription *vmsd,
written_bytes);
/* If we used a fake temp field.. free it now */
- if (inner_field != field) {
+ if (is_null) {
g_clear_pointer((gpointer *)&inner_field, g_free);
}
--
2.35.3
- [PULL 09/42] physmem: preserve ram blocks for cpr, (continued)
- [PULL 09/42] physmem: preserve ram blocks for cpr, Fabiano Rosas, 2025/01/29
- [PULL 08/42] migration: cpr-state, Fabiano Rosas, 2025/01/29
- [PULL 13/42] migration: incoming channel, Fabiano Rosas, 2025/01/29
- [PULL 19/42] tests/qtest: optimize migrate_set_ports, Fabiano Rosas, 2025/01/29
- [PULL 18/42] migration-test: memory_backend, Fabiano Rosas, 2025/01/29
- [PULL 16/42] migration: cpr-transfer save and load, Fabiano Rosas, 2025/01/29
- [PULL 27/42] migration: Do not construct JSON description if suppressed, Fabiano Rosas, 2025/01/29
- [PULL 32/42] migration: Adjust postcopy bandwidth during switchover, Fabiano Rosas, 2025/01/29
- [PULL 31/42] migration: Synchronize all CPU states only for non-iterable dump, Fabiano Rosas, 2025/01/29
- [PULL 36/42] migration: Notify COMPLETE once for postcopy, Fabiano Rosas, 2025/01/29
- [PULL 41/42] migration: Trivial cleanup on JSON writer of vmstate_save(),
Fabiano Rosas <=
- [PULL 42/42] migration: refactor ram_save_target_page functions, Fabiano Rosas, 2025/01/29
- [PULL 17/42] migration: cpr-transfer mode, Fabiano Rosas, 2025/01/29
- [PULL 35/42] migration: Take BQL slightly longer in postcopy_start(), Fabiano Rosas, 2025/01/29
- [PULL 37/42] migration: Unwrap qemu_savevm_state_complete_precopy() in postcopy, Fabiano Rosas, 2025/01/29
- [PULL 38/42] migration: Cleanup qemu_savevm_state_complete_precopy(), Fabiano Rosas, 2025/01/29
- [PULL 39/42] migration: Always set DEVICE state, Fabiano Rosas, 2025/01/29
- [PULL 40/42] migration: Merge precopy/postcopy on switchover start, Fabiano Rosas, 2025/01/29