From 61abf1ebdcddafdb62ba6784e04c573ae6beace6 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 4 May 2023 13:38:39 +0200 Subject: [PATCH] qemu-file: Make total_transferred an uint64_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change all the functions that use it. It was already passed as uint64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrangé Message-Id: <20230504113841.23130-8-quintela@redhat.com> --- migration/block.c | 5 ++--- migration/qemu-file.c | 8 ++++---- migration/qemu-file.h | 4 ++-- migration/savevm.c | 6 ++---- migration/vmstate.c | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/migration/block.c b/migration/block.c index 3499f75e37..a37678ce95 100644 --- a/migration/block.c +++ b/migration/block.c @@ -747,8 +747,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - int64_t last_bytes = qemu_file_total_transferred(f); - int64_t delta_bytes; + uint64_t last_bytes = qemu_file_total_transferred(f); trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -800,7 +799,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; + uint64_t delta_bytes = qemu_file_total_transferred(f) - last_bytes; return (delta_bytes > 0); } diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 11b510aa29..ccbefc347e 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -51,7 +51,7 @@ struct QEMUFile { int64_t rate_limit_used; /* The sum of bytes transferred on the wire */ - int64_t total_transferred; + uint64_t total_transferred; int buf_index; int buf_size; /* 0 when writing */ @@ -708,9 +708,9 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } -int64_t qemu_file_total_transferred_fast(QEMUFile *f) +uint64_t qemu_file_total_transferred_fast(QEMUFile *f) { - int64_t ret = f->total_transferred; + uint64_t ret = f->total_transferred; int i; for (i = 0; i < f->iovcnt; i++) { @@ -720,7 +720,7 @@ int64_t qemu_file_total_transferred_fast(QEMUFile *f) return ret; } -int64_t qemu_file_total_transferred(QEMUFile *f) +uint64_t qemu_file_total_transferred(QEMUFile *f) { qemu_fflush(f); return f->total_transferred; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d16cd50448..4f26bf6961 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -83,7 +83,7 @@ int qemu_fclose(QEMUFile *f); * * Returns: the total bytes transferred */ -int64_t qemu_file_total_transferred(QEMUFile *f); +uint64_t qemu_file_total_transferred(QEMUFile *f); /* * qemu_file_total_transferred_fast: @@ -95,7 +95,7 @@ int64_t qemu_file_total_transferred(QEMUFile *f); * * Returns: the total bytes transferred and queued */ -int64_t qemu_file_total_transferred_fast(QEMUFile *f); +uint64_t qemu_file_total_transferred_fast(QEMUFile *f); /* * put_buffer without copying the buffer. diff --git a/migration/savevm.c b/migration/savevm.c index a9d0a88e62..032044b1d5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,11 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - int64_t old_offset, size; - - old_offset = qemu_file_total_transferred_fast(f); + uint64_t old_offset = qemu_file_total_transferred_fast(f); se->ops->save_state(f, se->opaque); - size = qemu_file_total_transferred_fast(f) - old_offset; + uint64_t size = qemu_file_total_transferred_fast(f) - old_offset; if (vmdesc) { json_writer_int64(vmdesc, "size", size); diff --git a/migration/vmstate.c b/migration/vmstate.c index 83ca4c7d3e..351f56104e 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -349,7 +349,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, void *first_elem = opaque + field->offset; int i, n_elems = vmstate_n_elems(opaque, field); int size = vmstate_size(opaque, field); - int64_t old_offset, written_bytes; + uint64_t old_offset, written_bytes; JSONWriter *vmdesc_loop = vmdesc; trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems);