* [Qemu-devel] migration: remove last_sent_block from save_page_header
@ 2015-03-23 8:30 Liang Li
0 siblings, 0 replies; only message in thread
From: Liang Li @ 2015-03-23 8:30 UTC (permalink / raw)
To: qemu-devel
Cc: quintela, liang.z.li, dgilbert, lcapitulino, yang.z.zhang,
quintela, amit.shah
From: Juan Quintela <quintela@redhat.com>
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 <quintela@redhat.com>
---
arch_init.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index fcfa328..4c8fcee 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -332,19 +332,14 @@ static size_t save_page_header(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
{
size_t size;
- if (block == last_sent_block) {
- offset |= RAM_SAVE_FLAG_CONTINUE;
- }
-
qemu_put_be64(f, offset);
size = 8;
- if (block != last_sent_block) {
+ if (!(offset & RAM_SAVE_FLAG_CONTINUE)) {
qemu_put_byte(f, strlen(block->idstr));
qemu_put_buffer(f, (uint8_t *)block->idstr,
strlen(block->idstr));
size += 1 + strlen(block->idstr);
- last_sent_block = block;
}
return size;
}
@@ -644,6 +639,10 @@ static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset,
XBZRLE_cache_lock();
current_addr = block->offset + offset;
+
+ if (block == last_sent_block) {
+ offset |= RAM_SAVE_FLAG_CONTINUE;
+ }
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
if (ret != RAM_SAVE_CONTROL_DELAYED) {
if (bytes_xmit > 0) {
@@ -739,6 +738,7 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage,
/* if page is unmodified, continue to the next */
if (pages > 0) {
+ last_sent_block = block;
break;
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-23 8:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 8:30 [Qemu-devel] migration: remove last_sent_block from save_page_header Liang Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).