diff options
author | Juan Quintela <quintela@redhat.com> | 2012-07-20 10:16:08 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-10-17 18:34:58 +0200 |
commit | e44d26c8f3894a220f29ff5b27abf87f570d2c07 (patch) | |
tree | 3d6897b71d940b41c45e873fd03b19a29bb47ef6 /arch_init.c | |
parent | 5a17077529f7feec559e1881792e89554c2ae5b6 (diff) |
ram: introduce migration_bitmap_set_dirty()
It just marks a region of memory as dirty.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r-- | arch_init.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/arch_init.c b/arch_init.c index 6b9f949db3..fa470515db 100644 --- a/arch_init.c +++ b/arch_init.c @@ -331,6 +331,18 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, static RAMBlock *last_block; static ram_addr_t last_offset; +static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length) +{ + ram_addr_t addr; + + for (addr = 0; addr < length; addr += TARGET_PAGE_SIZE) { + if (!memory_region_get_dirty(mr, addr, TARGET_PAGE_SIZE, + DIRTY_MEMORY_MIGRATION)) { + memory_region_set_dirty(mr, addr, TARGET_PAGE_SIZE); + } + } +} + /* * ram_save_block: Writes a page of memory to the stream f * @@ -493,7 +505,6 @@ static void reset_ram_globals(void) static int ram_save_setup(QEMUFile *f, void *opaque) { - ram_addr_t addr; RAMBlock *block; bytes_transferred = 0; @@ -514,12 +525,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) /* Make sure all dirty bits are set */ QLIST_FOREACH(block, &ram_list.blocks, next) { - for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) { - if (!memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE, - DIRTY_MEMORY_MIGRATION)) { - memory_region_set_dirty(block->mr, addr, TARGET_PAGE_SIZE); - } - } + migration_bitmap_set_dirty(block->mr, block->length); } memory_global_dirty_log_start(); |