mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration: Move rate_limit_max and rate_limit_used to migration_stats
These way we can make them atomic and use this functions from any place. I also moved all functions that use rate_limit to migration-stats. Functions got renamed, they are not qemu_file anymore. qemu_file_rate_limit -> migration_rate_exceeded qemu_file_set_rate_limit -> migration_rate_set qemu_file_get_rate_limit -> migration_rate_get qemu_file_reset_rate_limit -> migration_rate_reset qemu_file_acct_rate_limit -> migration_rate_account. Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230515195709.63843-6-quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
de37f8b9c2
commit
e1fde0e038
16 changed files with 124 additions and 90 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "block/dirty-bitmap.h"
|
||||
#include "migration/misc.h"
|
||||
#include "migration.h"
|
||||
#include "migration-stats.h"
|
||||
#include "migration/register.h"
|
||||
#include "qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
@ -625,7 +626,7 @@ static int flush_blks(QEMUFile *f)
|
|||
|
||||
blk_mig_lock();
|
||||
while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
|
||||
if (qemu_file_rate_limit(f)) {
|
||||
if (migration_rate_exceeded(f)) {
|
||||
break;
|
||||
}
|
||||
if (blk->ret < 0) {
|
||||
|
@ -762,7 +763,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
|
|||
/* control the rate of transfer */
|
||||
blk_mig_lock();
|
||||
while (block_mig_state.read_done * BLK_MIG_BLOCK_SIZE <
|
||||
qemu_file_get_rate_limit(f) &&
|
||||
migration_rate_get() &&
|
||||
block_mig_state.submitted < MAX_PARALLEL_IO &&
|
||||
(block_mig_state.submitted + block_mig_state.read_done) <
|
||||
MAX_IO_BUFFERS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue