From de37f8b9c21e1c6ef98eebb0b05bd83e5867bc6f Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 15 May 2023 21:56:57 +0200 Subject: qemu-file: Account for rate_limit usage on qemu_fflush() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That is the moment we know we have transferred something. Signed-off-by: Juan Quintela Reviewed-by: Cédric Le Goater Message-Id: <20230515195709.63843-5-quintela@redhat.com> --- migration/qemu-file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'migration') diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9728002..3d66c5c 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -302,7 +302,9 @@ void qemu_fflush(QEMUFile *f) &local_error) < 0) { qemu_file_set_error_obj(f, -EIO, local_error); } else { - f->total_transferred += iov_size(f->iov, f->iovcnt); + uint64_t size = iov_size(f->iov, f->iovcnt); + qemu_file_acct_rate_limit(f, size); + f->total_transferred += size; } qemu_iovec_release_ram(f); @@ -519,7 +521,6 @@ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, return; } - f->rate_limit_used += size; add_to_iovec(f, buf, size, may_free); } @@ -537,7 +538,6 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size) l = size; } memcpy(f->buf + f->buf_index, buf, l); - f->rate_limit_used += l; add_buf_to_iovec(f, l); if (qemu_file_get_error(f)) { break; @@ -554,7 +554,6 @@ void qemu_put_byte(QEMUFile *f, int v) } f->buf[f->buf_index] = v; - f->rate_limit_used++; add_buf_to_iovec(f, 1); } -- cgit v1.1