[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/16] qemu-file: We only call qemu_file_transferred_* on the sen
From: |
Juan Quintela |
Subject: |
[PATCH 05/16] qemu-file: We only call qemu_file_transferred_* on the sending side |
Date: |
Tue, 30 May 2023 14:28:02 +0200 |
Remove the increase in qemu_file_fill_buffer() and add asserts to
qemu_file_transferred* functions.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/qemu-file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 38984504ba..5ff3bc40fd 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -340,7 +340,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 {
@@ -632,6 +631,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;
}
@@ -641,6 +642,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;
}
--
2.40.1
- [PATCH 15/16] migration: Remove transferred atomic counter, (continued)
- [PATCH 15/16] migration: Remove transferred atomic counter, Juan Quintela, 2023/05/30
- [PATCH 16/16] qemu-file: Make qemu_fflush() return errors, Juan Quintela, 2023/05/30
- [PATCH 02/16] migration: Change qemu_file_transferred to noflush, Juan Quintela, 2023/05/30
- [PATCH 06/16] qemu_file: Use a stat64 for qemu_file_transferred, Juan Quintela, 2023/05/30
- [PATCH 03/16] migration: Use qemu_file_transferred_noflush() for block migration., Juan Quintela, 2023/05/30
- [PATCH 13/16] qemu-file: Simplify qemu_file_get_error(), Juan Quintela, 2023/05/30
- [PATCH 05/16] qemu-file: We only call qemu_file_transferred_* on the sending side,
Juan Quintela <=
- [PATCH 08/16] migration: Use the number of transferred bytes directly, Juan Quintela, 2023/05/30
- [PATCH 09/16] qemu_file: Remove unused qemu_file_transferred(), Juan Quintela, 2023/05/30
- [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files, Juan Quintela, 2023/05/30
- Re: [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files, Juan Quintela, 2023/05/30
[PATCH 10/16] qemu-file: Remove _noflush from qemu_file_transferred_noflush(), Juan Quintela, 2023/05/30