mirror of https://github.com/xemu-project/xemu.git
ram: Introduce migration_bitmap_test_and_reset_dirty()
It just test if the dirty bit is set, and clears it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
parent
e44d26c8f3
commit
69268cde14
19
arch_init.c
19
arch_init.c
|
@ -331,6 +331,19 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
|
||||||
static RAMBlock *last_block;
|
static RAMBlock *last_block;
|
||||||
static ram_addr_t last_offset;
|
static ram_addr_t last_offset;
|
||||||
|
|
||||||
|
static inline bool migration_bitmap_test_and_reset_dirty(MemoryRegion *mr,
|
||||||
|
ram_addr_t offset)
|
||||||
|
{
|
||||||
|
bool ret = memory_region_get_dirty(mr, offset, TARGET_PAGE_SIZE,
|
||||||
|
DIRTY_MEMORY_MIGRATION);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
memory_region_reset_dirty(mr, offset, TARGET_PAGE_SIZE,
|
||||||
|
DIRTY_MEMORY_MIGRATION);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length)
|
static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length)
|
||||||
{
|
{
|
||||||
ram_addr_t addr;
|
ram_addr_t addr;
|
||||||
|
@ -364,14 +377,10 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
mr = block->mr;
|
mr = block->mr;
|
||||||
if (memory_region_get_dirty(mr, offset, TARGET_PAGE_SIZE,
|
if (migration_bitmap_test_and_reset_dirty(mr, offset)) {
|
||||||
DIRTY_MEMORY_MIGRATION)) {
|
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
int cont = (block == last_block) ? RAM_SAVE_FLAG_CONTINUE : 0;
|
int cont = (block == last_block) ? RAM_SAVE_FLAG_CONTINUE : 0;
|
||||||
|
|
||||||
memory_region_reset_dirty(mr, offset, TARGET_PAGE_SIZE,
|
|
||||||
DIRTY_MEMORY_MIGRATION);
|
|
||||||
|
|
||||||
p = memory_region_get_ram_ptr(mr) + offset;
|
p = memory_region_get_ram_ptr(mr) + offset;
|
||||||
|
|
||||||
if (is_dup_page(p)) {
|
if (is_dup_page(p)) {
|
||||||
|
|
Loading…
Reference in New Issue