multifd: Make zlib compression method not use iovs
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
f5ff548774
commit
a5ed229488
@ -13,6 +13,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include <zlib.h>
|
||||
#include "qemu/rcu.h"
|
||||
#include "exec/ramblock.h"
|
||||
#include "exec/target_page.h"
|
||||
#include "qapi/error.h"
|
||||
#include "migration.h"
|
||||
@ -98,8 +99,8 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||
*/
|
||||
static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||
{
|
||||
struct iovec *iov = p->pages->iov;
|
||||
struct zlib_data *z = p->data;
|
||||
size_t page_size = qemu_target_page_size();
|
||||
z_stream *zs = &z->zs;
|
||||
uint32_t out_size = 0;
|
||||
int ret;
|
||||
@ -113,8 +114,8 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||
flush = Z_SYNC_FLUSH;
|
||||
}
|
||||
|
||||
zs->avail_in = iov[i].iov_len;
|
||||
zs->next_in = iov[i].iov_base;
|
||||
zs->avail_in = page_size;
|
||||
zs->next_in = p->pages->block->host + p->pages->offset[i];
|
||||
|
||||
zs->avail_out = available;
|
||||
zs->next_out = z->zbuff + out_size;
|
||||
@ -235,6 +236,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p)
|
||||
static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
||||
{
|
||||
struct zlib_data *z = p->data;
|
||||
size_t page_size = qemu_target_page_size();
|
||||
z_stream *zs = &z->zs;
|
||||
uint32_t in_size = p->next_packet_size;
|
||||
/* we measure the change of total_out */
|
||||
@ -259,7 +261,6 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
||||
zs->next_in = z->zbuff;
|
||||
|
||||
for (i = 0; i < p->pages->num; i++) {
|
||||
struct iovec *iov = &p->pages->iov[i];
|
||||
int flush = Z_NO_FLUSH;
|
||||
unsigned long start = zs->total_out;
|
||||
|
||||
@ -267,8 +268,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
||||
flush = Z_SYNC_FLUSH;
|
||||
}
|
||||
|
||||
zs->avail_out = iov->iov_len;
|
||||
zs->next_out = iov->iov_base;
|
||||
zs->avail_out = page_size;
|
||||
zs->next_out = p->pages->block->host + p->pages->offset[i];
|
||||
|
||||
/*
|
||||
* Welcome to inflate semantics
|
||||
@ -281,8 +282,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
|
||||
do {
|
||||
ret = inflate(zs, flush);
|
||||
} while (ret == Z_OK && zs->avail_in
|
||||
&& (zs->total_out - start) < iov->iov_len);
|
||||
if (ret == Z_OK && (zs->total_out - start) < iov->iov_len) {
|
||||
&& (zs->total_out - start) < page_size);
|
||||
if (ret == Z_OK && (zs->total_out - start) < page_size) {
|
||||
error_setg(errp, "multifd %d: inflate generated too few output",
|
||||
p->id);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user