[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/16] migration: Trivial cleanup on JSON writer of vmstate_save(
From: |
Peter Xu |
Subject: |
[PATCH 16/16] migration: Trivial cleanup on JSON writer of vmstate_save() |
Date: |
Tue, 14 Jan 2025 18:07:46 -0500 |
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>
---
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.47.0
- [PATCH 05/16] migration: Drop inactivate_disk param in qemu_savevm_state_complete*, (continued)
- [PATCH 05/16] migration: Drop inactivate_disk param in qemu_savevm_state_complete*, Peter Xu, 2025/01/14
- [PATCH 06/16] migration: Synchronize all CPU states only for non-iterable dump, Peter Xu, 2025/01/14
- [PATCH 08/16] migration: Adjust locking in migration_maybe_pause(), Peter Xu, 2025/01/14
- [PATCH 07/16] migration: Adjust postcopy bandwidth during switchover, Peter Xu, 2025/01/14
- [PATCH 10/16] migration: Take BQL slightly longer in postcopy_start(), Peter Xu, 2025/01/14
- [PATCH 12/16] migration: Unwrap qemu_savevm_state_complete_precopy() in postcopy, Peter Xu, 2025/01/14
- [PATCH 13/16] migration: Cleanup qemu_savevm_state_complete_precopy(), Peter Xu, 2025/01/14
- [PATCH 11/16] migration: Notify COMPLETE once for postcopy, Peter Xu, 2025/01/14
- [PATCH 14/16] migration: Always set DEVICE state, Peter Xu, 2025/01/14
- [PATCH 15/16] migration: Merge precopy/postcopy on switchover start, Peter Xu, 2025/01/14
- [PATCH 16/16] migration: Trivial cleanup on JSON writer of vmstate_save(),
Peter Xu <=
- [PATCH 09/16] migration: Drop cached migration state in migration_maybe_pause(), Peter Xu, 2025/01/14
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Jiri Denemark, 2025/01/15
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Juraj Marcin, 2025/01/15
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Fabiano Rosas, 2025/01/15