Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
qemu-file: Account for rate_limit usage on qemu_fflush()
That is the moment we know we have transferred something.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20230515195709.63843-5-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed May 18, 2023
1 parent 8e4b2a7 commit de37f8b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions migration/qemu-file.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand All @@ -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;
Expand All @@ -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);
}

Expand Down

0 comments on commit de37f8b

Please sign in to comment.