multifd: fix counters in multifd_send_thread

Previous commit cbec7eb768
"migration/multifd: Compute transferred bytes correctly"
removed accounting for packet_len in non-rdma
case, but the next_packet_size only accounts for pages, not for
the header packet (normal_pages * PAGE_SIZE) that is being sent
as iov[0]. The packet_len part should be added to account for
the size of MultiFDPacket and the array of the offsets.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231011184358.97349-4-elena.ufimtseva@oracle.com>
This commit is contained in:
Elena Ufimtseva 2023-10-11 11:43:57 -07:00 committed by Juan Quintela
parent 60c7981aa3
commit 68b6e00048

View File

@ -714,8 +714,6 @@ static void *multifd_send_thread(void *opaque)
if (ret != 0) { if (ret != 0) {
break; break;
} }
stat64_add(&mig_stats.multifd_bytes, p->packet_len);
stat64_add(&mig_stats.transferred, p->packet_len);
} else { } else {
/* Send header using the same writev call */ /* Send header using the same writev call */
p->iov[0].iov_len = p->packet_len; p->iov[0].iov_len = p->packet_len;
@ -728,8 +726,10 @@ static void *multifd_send_thread(void *opaque)
break; break;
} }
stat64_add(&mig_stats.multifd_bytes, p->next_packet_size); stat64_add(&mig_stats.multifd_bytes,
stat64_add(&mig_stats.transferred, p->next_packet_size); p->next_packet_size + p->packet_len);
stat64_add(&mig_stats.transferred,
p->next_packet_size + p->packet_len);
qemu_mutex_lock(&p->mutex); qemu_mutex_lock(&p->mutex);
p->pending_job--; p->pending_job--;
qemu_mutex_unlock(&p->mutex); qemu_mutex_unlock(&p->mutex);