mirror of https://github.com/xemu-project/xemu.git
qemu-file: Don't increment qemu_file_transferred at qemu_file_fill_buffer
We only call qemu_file_transferred_* on the sending side. Remove the increment at qemu_file_fill_buffer() and add asserts to qemu_file_transferred* functions. Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231025091117.6342-2-quintela@redhat.com>
This commit is contained in:
parent
a2326705e5
commit
cc8bf57d56
|
@ -337,7 +337,6 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile *f)
|
|||
|
||||
if (len > 0) {
|
||||
f->buf_size += len;
|
||||
f->total_transferred += len;
|
||||
} else if (len == 0) {
|
||||
qemu_file_set_error_obj(f, -EIO, local_error);
|
||||
} else {
|
||||
|
@ -627,6 +626,8 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f)
|
|||
uint64_t ret = f->total_transferred;
|
||||
int i;
|
||||
|
||||
g_assert(qemu_file_is_writable(f));
|
||||
|
||||
for (i = 0; i < f->iovcnt; i++) {
|
||||
ret += f->iov[i].iov_len;
|
||||
}
|
||||
|
@ -636,6 +637,7 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f)
|
|||
|
||||
uint64_t qemu_file_transferred(QEMUFile *f)
|
||||
{
|
||||
g_assert(qemu_file_is_writable(f));
|
||||
qemu_fflush(f);
|
||||
return f->total_transferred;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue