diff options
author | Juan Quintela <quintela@redhat.com> | 2021-11-22 13:26:18 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2022-01-28 15:38:23 +0100 |
commit | 815956f03902980c771da64b17f7f791c1cb57b0 (patch) | |
tree | 6985aac34b627d69400ec80cc62c17754283a6b4 /migration/multifd-zlib.c | |
parent | c27779a215843e92eb120de80f982f3a63d1becb (diff) | |
download | qemu-815956f03902980c771da64b17f7f791c1cb57b0.zip qemu-815956f03902980c771da64b17f7f791c1cb57b0.tar.gz qemu-815956f03902980c771da64b17f7f791c1cb57b0.tar.bz2 |
multifd: Use normal pages array on the send side
We are only sending normal pages through multifd channels.
Later on this series, we are going to also send zero pages.
We are going to detect if a page is zero or non zero in the multifd
channel thread, not on the main thread.
So we receive an array of pages page->offset[N]
And we will end with:
p->normal[N - zero_pages]
p->zero[zero_pages].
In this patch, we just copy all the pages in offset to normal.
for (i = 0; i < pages->num; i++) {
p->narmal[p->normal_num] = pages->offset[i];
p->normal_num++:
}
Later in the series this becomes:
for (i = 0; i < pages->num; i++) {
if (buffer_is_zero(page->offset[i])) {
p->zerol[p->zero_num] = pages->offset[i];
p->zero_num++:
} else {
p->narmal[p->normal_num] = pages->offset[i];
p->normal_num++:
}
}
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
Improving comment (dave)
Renaming num_normal_pages to total_normal_pages (peter)
Diffstat (limited to 'migration/multifd-zlib.c')
-rw-r--r-- | migration/multifd-zlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index ba90f1a..7f4fbef 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -106,16 +106,16 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp) int ret; uint32_t i; - for (i = 0; i < p->pages->num; i++) { + for (i = 0; i < p->normal_num; i++) { uint32_t available = z->zbuff_len - out_size; int flush = Z_NO_FLUSH; - if (i == p->pages->num - 1) { + if (i == p->normal_num - 1) { flush = Z_SYNC_FLUSH; } zs->avail_in = page_size; - zs->next_in = p->pages->block->host + p->pages->offset[i]; + zs->next_in = p->pages->block->host + p->normal[i]; zs->avail_out = available; zs->next_out = z->zbuff + out_size; |