diff options
-rw-r--r-- | arch_init.c | 12 | ||||
-rw-r--r-- | include/migration/migration.h | 2 | ||||
-rw-r--r-- | include/migration/qemu-file.h | 1 | ||||
-rw-r--r-- | savevm.c | 5 |
4 files changed, 20 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c index 4dd17f4..ea9ddad 100644 --- a/arch_init.c +++ b/arch_init.c @@ -493,6 +493,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage) static uint64_t bytes_transferred; +void acct_update_position(QEMUFile *f, size_t size, bool zero) +{ + uint64_t pages = size / TARGET_PAGE_SIZE; + if (zero) { + acct_info.dup_pages += pages; + } else { + acct_info.norm_pages += pages; + bytes_transferred += size; + qemu_update_position(f, size); + } +} + static ram_addr_t ram_save_remaining(void) { return migration_dirty_pages; diff --git a/include/migration/migration.h b/include/migration/migration.h index e2acec6..0be28a2 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -92,6 +92,8 @@ uint64_t ram_bytes_remaining(void); uint64_t ram_bytes_transferred(void); uint64_t ram_bytes_total(void); +void acct_update_position(QEMUFile *f, size_t size, bool zero); + extern SaveVMHandlers savevm_ram_handlers; uint64_t dup_mig_bytes_transferred(void); diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index 7519464..8fab0dd 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -93,6 +93,7 @@ void qemu_put_be32(QEMUFile *f, unsigned int v); void qemu_put_be64(QEMUFile *f, uint64_t v); int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size); int qemu_get_byte(QEMUFile *f); +void qemu_update_position(QEMUFile *f, size_t size); static inline unsigned int qemu_get_ubyte(QEMUFile *f) { @@ -671,6 +671,11 @@ int qemu_get_fd(QEMUFile *f) return -1; } +void qemu_update_position(QEMUFile *f, size_t size) +{ + f->pos += size; +} + /** Closes the file * * Returns negative error value if any error happened on previous operations or |