diff options
author | Juan Quintela <quintela@redhat.com> | 2021-11-22 16:21:16 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2021-12-15 10:31:42 +0100 |
commit | 144fa06b3431e806057ce1438338395b35a3e544 (patch) | |
tree | f72a6593af2d1680635e940bc21b39baaee836f6 /migration/multifd.c | |
parent | 47a17824613fc88b938f4fd9585931e03517f440 (diff) |
migration: Never call twice qemu_target_page_size()
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/multifd.c')
-rw-r--r-- | migration/multifd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/migration/multifd.c b/migration/multifd.c index 7c9deb1921..8125d0015c 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -289,7 +289,8 @@ static void multifd_send_fill_packet(MultiFDSendParams *p) static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) { MultiFDPacket_t *packet = p->packet; - uint32_t pages_max = MULTIFD_PACKET_SIZE / qemu_target_page_size(); + size_t page_size = qemu_target_page_size(); + uint32_t pages_max = MULTIFD_PACKET_SIZE / page_size; RAMBlock *block; int i; @@ -358,14 +359,14 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) for (i = 0; i < p->pages->used; i++) { uint64_t offset = be64_to_cpu(packet->offset[i]); - if (offset > (block->used_length - qemu_target_page_size())) { + if (offset > (block->used_length - page_size)) { error_setg(errp, "multifd: offset too long %" PRIu64 " (max " RAM_ADDR_FMT ")", offset, block->used_length); return -1; } p->pages->iov[i].iov_base = block->host + offset; - p->pages->iov[i].iov_len = qemu_target_page_size(); + p->pages->iov[i].iov_len = page_size; } return 0; |