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>
This commit is contained in:
Juan Quintela 2023-05-08 15:08:51 +02:00
parent 52d01d4a5d
commit 9d3ebbe217
3 changed files with 10 additions and 7 deletions

View file

@ -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)