aboutsummaryrefslogtreecommitdiff
path: root/migration/qemu-file.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-05-15 21:57:08 +0200
committerJuan Quintela <quintela@redhat.com>2023-09-29 18:13:53 +0200
commit9c53d369e5903375a2e3358f739be77dcb8dae49 (patch)
tree0d15f5d95f13d2a88c7145ccbaee42a49237dbbc /migration/qemu-file.h
parent9f51fe92392f601a177687bef01a545298cb47e1 (diff)
downloadqemu-9c53d369e5903375a2e3358f739be77dcb8dae49.zip
qemu-9c53d369e5903375a2e3358f739be77dcb8dae49.tar.gz
qemu-9c53d369e5903375a2e3358f739be77dcb8dae49.tar.bz2
migration/rdma: Simplify the function that saves a page
When we sent a page through QEMUFile hooks (RDMA) there are three posiblities: - We are not using RDMA. return RAM_SAVE_CONTROL_DELAYED and control_save_page() returns false to let anything else to proceed. - There is one error but we are using RDMA. Then we return a negative value, control_save_page() needs to return true. - Everything goes well and RDMA start the sent of the page asynchronously. It returns RAM_SAVE_CONTROL_DELAYED and we need to return 1 for ram_save_page_legacy. Clear? I know, I know, the interface is as bad as it gets. I think that now it is a bit clearer, but this needs to be done some other way. Reviewed-by: Leonardo Bras <leobras@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230515195709.63843-16-quintela@redhat.com>
Diffstat (limited to 'migration/qemu-file.h')
-rw-r--r--migration/qemu-file.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 57b00c8..03e718c 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -49,11 +49,10 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data);
* This function allows override of where the RAM page
* is saved (such as RDMA, for example.)
*/
-typedef size_t (QEMURamSaveFunc)(QEMUFile *f,
- ram_addr_t block_offset,
- ram_addr_t offset,
- size_t size,
- uint64_t *bytes_sent);
+typedef int (QEMURamSaveFunc)(QEMUFile *f,
+ ram_addr_t block_offset,
+ ram_addr_t offset,
+ size_t size);
typedef struct QEMUFileHooks {
QEMURamHookFunc *before_ram_iterate;
@@ -142,9 +141,8 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
#define RAM_SAVE_CONTROL_NOT_SUPP -1000
#define RAM_SAVE_CONTROL_DELAYED -2000
-size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
- ram_addr_t offset, size_t size,
- uint64_t *bytes_sent);
+int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
+ ram_addr_t offset, size_t size);
QIOChannel *qemu_file_get_ioc(QEMUFile *file);
#endif