Skip to content

Commit 43edc0e

Browse files
author
Juan Quintela
committed
migration: remove last_sent_block from save_page_header
Compression code (still not on tree) want to call this funtion from outside the migration thread, so we can't write to last_sent_block. Instead of reverting full patch: [PULL 07/11] save_block_hdr: we can recalculate Just revert the parts that touch last_sent_block. Signed-off-by: Juan Quintela <[email protected]> Reviewed-by: Dr. David Alan Gilbert <[email protected]>
1 parent 80b262e commit 43edc0e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch_init.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -332,19 +332,14 @@ static size_t save_page_header(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
332332
{
333333
size_t size;
334334

335-
if (block == last_sent_block) {
336-
offset |= RAM_SAVE_FLAG_CONTINUE;
337-
}
338-
339335
qemu_put_be64(f, offset);
340336
size = 8;
341337

342-
if (block != last_sent_block) {
338+
if (!(offset & RAM_SAVE_FLAG_CONTINUE)) {
343339
qemu_put_byte(f, strlen(block->idstr));
344340
qemu_put_buffer(f, (uint8_t *)block->idstr,
345341
strlen(block->idstr));
346342
size += 1 + strlen(block->idstr);
347-
last_sent_block = block;
348343
}
349344
return size;
350345
}
@@ -644,6 +639,10 @@ static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset,
644639
XBZRLE_cache_lock();
645640

646641
current_addr = block->offset + offset;
642+
643+
if (block == last_sent_block) {
644+
offset |= RAM_SAVE_FLAG_CONTINUE;
645+
}
647646
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
648647
if (ret != RAM_SAVE_CONTROL_DELAYED) {
649648
if (bytes_xmit > 0) {
@@ -739,6 +738,7 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage,
739738

740739
/* if page is unmodified, continue to the next */
741740
if (pages > 0) {
741+
last_sent_block = block;
742742
break;
743743
}
744744
}

0 commit comments

Comments
 (0)