[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/20] qemu-file: We only call qemu_file_transferred_* on the
From: |
Juan Quintela |
Subject: |
[PATCH v2 04/20] qemu-file: We only call qemu_file_transferred_* on the sending side |
Date: |
Tue, 30 May 2023 20:39:25 +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 7a5c1a5e32..be3dab85cb 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -342,7 +342,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 v2 00/20] Next round of migration atomic counters, Juan Quintela, 2023/05/30
- [PATCH v2 02/20] migration: Change qemu_file_transferred to noflush, Juan Quintela, 2023/05/30
- [PATCH v2 01/20] qemu-file: Rename qemu_file_transferred_ fast -> noflush, Juan Quintela, 2023/05/30
- [PATCH v2 04/20] qemu-file: We only call qemu_file_transferred_* on the sending side,
Juan Quintela <=
- [PATCH v2 03/20] migration: Use qemu_file_transferred_noflush() for block migration., Juan Quintela, 2023/05/30
- [PATCH v2 05/20] qemu_file: Use a stat64 for qemu_file_transferred, Juan Quintela, 2023/05/30
- [PATCH v2 07/20] migration: Use the number of transferred bytes directly, Juan Quintela, 2023/05/30
- [PATCH v2 06/20] qemu_file: total_transferred is not used anymore, Juan Quintela, 2023/05/30
- [PATCH v2 08/20] qemu_file: Remove unused qemu_file_transferred(), Juan Quintela, 2023/05/30
- [PATCH v2 09/20] qemu-file: Remove _noflush from qemu_file_transferred_noflush(), Juan Quintela, 2023/05/30
- [PATCH v2 10/20] migration: migration_transferred_bytes() don't need the QEMUFile, Juan Quintela, 2023/05/30
- [PATCH v2 11/20] migration: migration_rate_limit_reset() don't need the QEMUFile, Juan Quintela, 2023/05/30
- [PATCH v2 13/20] migration: Use migration_transferred_bytes(), Juan Quintela, 2023/05/30
- [PATCH v2 12/20] qemu-file: Simplify qemu_file_get_error(), Juan Quintela, 2023/05/30