aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-05-04 13:38:34 +0200
committerJuan Quintela <quintela@redhat.com>2023-05-05 01:04:33 +0200
commitf3030d34401ffa1c6dd922eea42225b49b7077c0 (patch)
tree3750174ef87c7a087327ec6cc067bd9aa4465e05 /migration
parent520333490a3c082a8f65f572042637543c4bf148 (diff)
downloadqemu-f3030d34401ffa1c6dd922eea42225b49b7077c0.zip
qemu-f3030d34401ffa1c6dd922eea42225b49b7077c0.tar.gz
qemu-f3030d34401ffa1c6dd922eea42225b49b7077c0.tar.bz2
migration: qemu_file_total_transferred() function is monotonic
So delta_bytes can only be greater or equal to zero. Never negative. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230504113841.23130-3-quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/block.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/migration/block.c b/migration/block.c
index 6d532ac..3499f75 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -801,13 +801,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
delta_bytes = qemu_file_total_transferred(f) - last_bytes;
- if (delta_bytes > 0) {
- return 1;
- } else if (delta_bytes < 0) {
- return -1;
- } else {
- return 0;
- }
+ return (delta_bytes > 0);
}
/* Called with iothread lock taken. */