[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 03/11] Add save_block_hdr function
From: |
Orit Wasserman |
Subject: |
[Qemu-devel] [PATCH v7 03/11] Add save_block_hdr function |
Date: |
Thu, 26 Jan 2012 16:24:49 +0200 |
Signed-off-by: Orit Wasserman <address@hidden>
---
arch_init.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index bdc74a9..ac21bc0 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -300,6 +300,17 @@ static void cache_insert(unsigned long addr, uint8_t
*pdata)
it->it_addr = addr;
}
+static void save_block_hdr(QEMUFile *f, RAMBlock *block, ram_addr_t offset,
+ int cont, int flag)
+{
+ qemu_put_be64(f, offset | cont | flag);
+ if (!cont) {
+ qemu_put_byte(f, strlen(block->idstr));
+ qemu_put_buffer(f, (uint8_t *)block->idstr,
+ strlen(block->idstr));
+ }
+}
+
static RAMBlock *last_block;
static ram_addr_t last_offset;
@@ -325,21 +336,11 @@ static int ram_save_block(QEMUFile *f)
p = memory_region_get_ram_ptr(mr) + offset;
if (is_dup_page(p)) {
- qemu_put_be64(f, offset | cont | RAM_SAVE_FLAG_COMPRESS);
- if (!cont) {
- qemu_put_byte(f, strlen(block->idstr));
- qemu_put_buffer(f, (uint8_t *)block->idstr,
- strlen(block->idstr));
- }
+ save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_COMPRESS);
qemu_put_byte(f, *p);
bytes_sent = 1;
} else {
- qemu_put_be64(f, offset | cont | RAM_SAVE_FLAG_PAGE);
- if (!cont) {
- qemu_put_byte(f, strlen(block->idstr));
- qemu_put_buffer(f, (uint8_t *)block->idstr,
- strlen(block->idstr));
- }
+ save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_PAGE);
qemu_put_buffer(f, p, TARGET_PAGE_SIZE);
bytes_sent = TARGET_PAGE_SIZE;
}
--
1.7.6.5
- [Qemu-devel] [PATCH v7 00/11] XBRLE delta for live migration of large memory app, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 01/11] Add cache handling functions, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 03/11] Add save_block_hdr function,
Orit Wasserman <=
- [Qemu-devel] [PATCH v7 04/11] Add host_from_stream_offset_versioned function, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 02/11] Add uleb encoding/decoding functions, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 07/11] Add XBZRLE parameters to MigrationState, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 06/11] Add MigrationParams structure, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 05/11] Add XBZRLE to ram_save_block and ram_save_live, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 08/11] Add migration capabilties, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 09/11] Add set_cachesize command, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 10/11] Add XBZRLE option to migrate command, Orit Wasserman, 2012/01/26
- [Qemu-devel] [PATCH v7 11/11] Add XBZRLE statstics information, Orit Wasserman, 2012/01/26