[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/9] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_
From: |
Juan Quintela |
Subject: |
[PATCH 3/9] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t |
Date: |
Thu, 4 May 2023 13:38:35 +0200 |
It is really size_t. Everything else uses uint64_t, so move this to
uint64_t as well. A size can't be negative anyways.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 6 +++---
migration/qemu-file.c | 8 ++++----
migration/qemu-file.h | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 232e387109..ee75c6cfbd 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2119,7 +2119,7 @@ static int postcopy_start(MigrationState *ms)
*/
/* 0 max-postcopy-bandwidth means unlimited */
if (!bandwidth) {
- qemu_file_set_rate_limit(ms->to_dst_file, INT64_MAX);
+ qemu_file_set_rate_limit(ms->to_dst_file, UINT64_MAX);
} else {
qemu_file_set_rate_limit(ms->to_dst_file, bandwidth /
XFER_LIMIT_RATIO);
}
@@ -2301,7 +2301,7 @@ static void migration_completion(MigrationState *s)
}
if (ret >= 0) {
s->block_inactive = !migrate_colo();
- qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX);
+ qemu_file_set_rate_limit(s->to_dst_file, UINT64_MAX);
ret = qemu_savevm_state_complete_precopy(s->to_dst_file, false,
s->block_inactive);
}
@@ -3049,7 +3049,7 @@ static void *bg_migration_thread(void *opaque)
rcu_register_thread();
object_ref(OBJECT(s));
- qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX);
+ qemu_file_set_rate_limit(s->to_dst_file, UINT64_MAX);
setup_start = qemu_clock_get_ms(QEMU_CLOCK_HOST);
/*
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index ee04240a21..b322b363cf 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -43,7 +43,7 @@ struct QEMUFile {
* Maximum amount of data in bytes to transfer during one
* rate limiting time window
*/
- int64_t rate_limit_max;
+ uint64_t rate_limit_max;
/*
* Total amount of data in bytes queued for transfer
* during this rate limiting time window
@@ -748,18 +748,18 @@ int qemu_file_rate_limit(QEMUFile *f)
if (qemu_file_get_error(f)) {
return 1;
}
- if (f->rate_limit_max > 0 && f->rate_limit_used > f->rate_limit_max) {
+ if (f->rate_limit_used > f->rate_limit_max) {
return 1;
}
return 0;
}
-int64_t qemu_file_get_rate_limit(QEMUFile *f)
+uint64_t qemu_file_get_rate_limit(QEMUFile *f)
{
return f->rate_limit_max;
}
-void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit)
+void qemu_file_set_rate_limit(QEMUFile *f, uint64_t limit)
{
f->rate_limit_max = limit;
}
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index d16cd50448..9e158c00f6 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -138,8 +138,8 @@ void qemu_file_reset_rate_limit(QEMUFile *f);
* need to be applied to the rate limiting calcuations
*/
void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len);
-void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
-int64_t qemu_file_get_rate_limit(QEMUFile *f);
+void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate);
+uint64_t qemu_file_get_rate_limit(QEMUFile *f);
int qemu_file_get_error_obj(QEMUFile *f, Error **errp);
int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp);
void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err);
--
2.40.0
- Re: [PATCH 8/9] qemu-file: Make ram_control_save_page() use accessors for rate_limit, (continued)
[PATCH 3/9] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t,
Juan Quintela <=
Re: [PATCH 0/9] QEMU file cleanups, Peter Xu, 2023/05/04