summary refs log tree commit diff stats
path: root/migration/qemu-file.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-05-08 15:08:51 +0200
committerJuan Quintela <quintela@redhat.com>2023-05-15 13:44:07 +0200
commit9d3ebbe21749937f9c9270d0841016e57de3fb92 (patch)
tree13f586512eeadae46c8723ad8184701ae3ea26e2 /migration/qemu-file.c
parent52d01d4a5d6963e24ff59af0c39b47fd5d229fb7 (diff)
downloadfocaccia-qemu-9d3ebbe21749937f9c9270d0841016e57de3fb92.tar.gz
focaccia-qemu-9d3ebbe21749937f9c9270d0841016e57de3fb92.zip
migration: We set the rate_limit by a second
That the implementation does the check every 100 milliseconds is an
implementation detail that shouldn't be seen on the interfaz.
Notice that all callers of qemu_file_set_rate_limit() used the
division or pass 0, so this change is a NOP.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20230508130909.65420-4-quintela@redhat.com>
Diffstat (limited to 'migration/qemu-file.c')
-rw-r--r--migration/qemu-file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 61fb580342..60f6345033 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -29,6 +29,7 @@
 #include "migration.h"
 #include "qemu-file.h"
 #include "trace.h"
+#include "options.h"
 #include "qapi/error.h"
 
 #define IO_BUF_SIZE 32768
@@ -744,7 +745,10 @@ int64_t qemu_file_get_rate_limit(QEMUFile *f)
 
 void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit)
 {
-    f->rate_limit_max = limit;
+    /*
+     * 'limit' is per second.  But we check it each 100 miliseconds.
+     */
+    f->rate_limit_max = limit / XFER_LIMIT_RATIO;
 }
 
 void qemu_file_reset_rate_limit(QEMUFile *f)