multifd: recv side only needs the RAMBlock host address

So we can remove the MultiFDPages.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Juan Quintela 2021-11-22 14:10:57 +01:00
parent cf2d4aa8a2
commit faf60935df
4 changed files with 6 additions and 9 deletions

View file

@ -253,7 +253,7 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
}
zs->avail_out = page_size;
zs->next_out = p->pages->block->host + p->normal[i];
zs->next_out = p->host + p->normal[i];
/*
* Welcome to inflate semantics

View file

@ -264,7 +264,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error **errp)
z->in.pos = 0;
for (i = 0; i < p->normal_num; i++) {
z->out.dst = p->pages->block->host + p->normal[i];
z->out.dst = p->host + p->normal[i];
z->out.size = page_size;
z->out.pos = 0;

View file

@ -147,7 +147,7 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, Error **errp)
return -1;
}
for (int i = 0; i < p->normal_num; i++) {
p->iov[i].iov_base = p->pages->block->host + p->normal[i];
p->iov[i].iov_base = p->host + p->normal[i];
p->iov[i].iov_len = page_size;
}
return qio_channel_readv_all(p->c, p->iov, p->normal_num, errp);
@ -340,7 +340,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
return -1;
}
p->pages->block = block;
p->host = block->host;
for (i = 0; i < p->normal_num; i++) {
uint64_t offset = be64_to_cpu(packet->offset[i]);
@ -1007,8 +1007,6 @@ int multifd_load_cleanup(Error **errp)
qemu_sem_destroy(&p->sem_sync);
g_free(p->name);
p->name = NULL;
multifd_pages_clear(p->pages);
p->pages = NULL;
p->packet_len = 0;
g_free(p->packet);
p->packet = NULL;
@ -1149,7 +1147,6 @@ int multifd_load_setup(Error **errp)
qemu_sem_init(&p->sem_sync, 0);
p->quit = false;
p->id = i;
p->pages = multifd_pages_init(page_count);
p->packet_len = sizeof(MultiFDPacket_t)
+ sizeof(uint64_t) * page_count;
p->packet = g_malloc0(p->packet_len);

View file

@ -136,8 +136,8 @@ typedef struct {
bool running;
/* should this thread finish */
bool quit;
/* array of pages to receive */
MultiFDPages_t *pages;
/* ramblock host address */
uint8_t *host;
/* packet allocated len */
uint32_t packet_len;
/* pointer to the packet */