aboutsummaryrefslogtreecommitdiff
path: root/migration/ram.c
diff options
context:
space:
mode:
authorLukas Straub <lukasstraub2@web.de>2023-04-20 11:48:31 +0200
committerJuan Quintela <quintela@redhat.com>2023-05-08 15:25:26 +0200
commit4024cc8506139a8f04f3f99ba478880410af10f5 (patch)
treefa93c6e178d946193a406c37d522aefbe4141a86 /migration/ram.c
parentb1f17720c117d4811b5571d87dcbc5b99d79266b (diff)
downloadqemu-4024cc8506139a8f04f3f99ba478880410af10f5.zip
qemu-4024cc8506139a8f04f3f99ba478880410af10f5.tar.gz
qemu-4024cc8506139a8f04f3f99ba478880410af10f5.tar.bz2
ram compress: Assert that the file buffer matches the result
Before this series, "nothing to send" was handled by the file buffer being empty. Now it is tracked via param->result. Assert that the file buffer state matches the result. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/ram.c')
-rw-r--r--migration/ram.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 009681d..ee4ab31 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1321,11 +1321,13 @@ static int send_queued_data(CompressParam *param)
assert(block == pss->last_sent_block);
if (param->result == RES_ZEROPAGE) {
+ assert(qemu_file_buffer_empty(param->file));
len += save_page_header(pss, file, block, offset | RAM_SAVE_FLAG_ZERO);
qemu_put_byte(file, 0);
len += 1;
ram_release_page(block->idstr, offset);
} else if (param->result == RES_COMPRESS) {
+ assert(!qemu_file_buffer_empty(param->file));
len += save_page_header(pss, file, block,
offset | RAM_SAVE_FLAG_COMPRESS_PAGE);
len += qemu_put_qemu_file(file, param->file);