[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/34] migration/multifd: Introduce MultiFDSendData
From: |
Fabiano Rosas |
Subject: |
[PULL 16/34] migration/multifd: Introduce MultiFDSendData |
Date: |
Wed, 4 Sep 2024 09:43:59 -0300 |
Add a new data structure to replace p->pages in the multifd
channel. This new structure will hide the multifd payload type behind
an union, so we don't need to add a new field to the channel each time
we want to handle a different data type.
This also allow us to keep multifd_send_pages() as is, without needing
to complicate the pointer switching.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/multifd.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/migration/multifd.h b/migration/multifd.h
index 660a9882c2..7bb4a2cbc4 100644
--- a/migration/multifd.h
+++ b/migration/multifd.h
@@ -17,6 +17,7 @@
#include "ram.h"
typedef struct MultiFDRecvData MultiFDRecvData;
+typedef struct MultiFDSendData MultiFDSendData;
bool multifd_send_setup(void);
void multifd_send_shutdown(void);
@@ -88,6 +89,31 @@ struct MultiFDRecvData {
off_t file_offset;
};
+typedef enum {
+ MULTIFD_PAYLOAD_NONE,
+ MULTIFD_PAYLOAD_RAM,
+} MultiFDPayloadType;
+
+typedef union MultiFDPayload {
+ MultiFDPages_t ram;
+} MultiFDPayload;
+
+struct MultiFDSendData {
+ MultiFDPayloadType type;
+ MultiFDPayload u;
+};
+
+static inline bool multifd_payload_empty(MultiFDSendData *data)
+{
+ return data->type == MULTIFD_PAYLOAD_NONE;
+}
+
+static inline void multifd_set_payload_type(MultiFDSendData *data,
+ MultiFDPayloadType type)
+{
+ data->type = type;
+}
+
typedef struct {
/* Fields are only written at creating/deletion time */
/* No lock required for them, they are read only */
--
2.35.3
- [PULL 03/34] tests/qtest/migration-test: Fix bootfile cleanup handling, (continued)
- [PULL 03/34] tests/qtest/migration-test: Fix bootfile cleanup handling, Fabiano Rosas, 2024/09/04
- [PULL 04/34] tests/qtest/migration-test: Don't leak resp in multifd_mapped_ram_fdset_end(), Fabiano Rosas, 2024/09/04
- [PULL 05/34] tests/qtest/migration-test: Fix leaks in calc_dirtyrate_ready(), Fabiano Rosas, 2024/09/04
- [PULL 06/34] tests/qtest/migration-helpers: Fix migrate_get_socket_address() leak, Fabiano Rosas, 2024/09/04
- [PULL 07/34] tests/qtest/migration-test: Free QCRyptoTLSTestCertReq objects, Fabiano Rosas, 2024/09/04
- [PULL 08/34] tests/unit/crypto-tls-x509-helpers: deinit privkey in test_tls_cleanup, Fabiano Rosas, 2024/09/04
- [PULL 09/34] tests/qtest/migration-helpers: Don't dup argument to qdict_put_str(), Fabiano Rosas, 2024/09/04
- [PULL 11/34] tests/qtest/migration-test: Don't leak QTestState in test_multifd_tcp_cancel(), Fabiano Rosas, 2024/09/04
- [PULL 10/34] tests/qtest/migration-test: Don't strdup in get_dirty_rate(), Fabiano Rosas, 2024/09/04
- [PULL 15/34] migration/multifd: Pass in MultiFDPages_t to file_write_ramblock_iov, Fabiano Rosas, 2024/09/04
- [PULL 16/34] migration/multifd: Introduce MultiFDSendData,
Fabiano Rosas <=
- [PULL 14/34] migration/multifd: Remove pages->allocated, Fabiano Rosas, 2024/09/04
- [PULL 12/34] migration/multifd: Reduce access to p->pages, Fabiano Rosas, 2024/09/04
- [PULL 17/34] migration/multifd: Make MultiFDPages_t:offset a flexible array member, Fabiano Rosas, 2024/09/04
- [PULL 13/34] migration/multifd: Inline page_size and page_count, Fabiano Rosas, 2024/09/04
- [PULL 18/34] migration/multifd: Replace p->pages with an union pointer, Fabiano Rosas, 2024/09/04
- [PULL 19/34] migration/multifd: Move pages accounting into multifd_send_zero_page_detect(), Fabiano Rosas, 2024/09/04
- [PULL 20/34] migration/multifd: Remove total pages tracing, Fabiano Rosas, 2024/09/04
- [PULL 21/34] migration/multifd: Isolate ram pages packet data, Fabiano Rosas, 2024/09/04
- [PULL 22/34] migration/multifd: Don't send ram data during SYNC, Fabiano Rosas, 2024/09/04
- [PULL 23/34] migration/multifd: Replace multifd_send_state->pages with client data, Fabiano Rosas, 2024/09/04