mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
migration: Rename res_{postcopy,precopy}_only
Once that res_compatible is removed, they don't make sense anymore. We remove the _only preffix. And to make things clearer we rename them to must_precopy and can_postcopy. Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
24f254ed79
commit
24beea4efe
9 changed files with 59 additions and 66 deletions
|
@ -763,8 +763,8 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque)
|
|||
}
|
||||
|
||||
static void dirty_bitmap_state_pending(void *opaque,
|
||||
uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
DBMSaveState *s = &((DBMState *)opaque)->save;
|
||||
SaveBitmapState *dbms;
|
||||
|
@ -784,7 +784,7 @@ static void dirty_bitmap_state_pending(void *opaque,
|
|||
|
||||
trace_dirty_bitmap_state_pending(pending);
|
||||
|
||||
*res_postcopy_only += pending;
|
||||
*can_postcopy += pending;
|
||||
}
|
||||
|
||||
/* First occurrence of this bitmap. It should be created if doesn't exist */
|
||||
|
|
|
@ -853,9 +853,8 @@ static int block_save_complete(QEMUFile *f, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void block_state_pending(void *opaque,
|
||||
uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
static void block_state_pending(void *opaque, uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
/* Estimate pending number of bytes to send */
|
||||
uint64_t pending;
|
||||
|
@ -876,7 +875,7 @@ static void block_state_pending(void *opaque,
|
|||
|
||||
trace_migration_block_state_pending(pending);
|
||||
/* We don't do postcopy */
|
||||
*res_precopy_only += pending;
|
||||
*must_precopy += pending;
|
||||
}
|
||||
|
||||
static int block_load(QEMUFile *f, void *opaque, int version_id)
|
||||
|
|
|
@ -3863,18 +3863,18 @@ typedef enum {
|
|||
*/
|
||||
static MigIterateState migration_iteration_run(MigrationState *s)
|
||||
{
|
||||
uint64_t pend_pre, pend_post;
|
||||
uint64_t must_precopy, can_postcopy;
|
||||
bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
|
||||
|
||||
qemu_savevm_state_pending_estimate(&pend_pre, &pend_post);
|
||||
uint64_t pending_size = pend_pre + pend_post;
|
||||
qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy);
|
||||
uint64_t pending_size = must_precopy + can_postcopy;
|
||||
|
||||
trace_migrate_pending_estimate(pending_size, pend_pre, pend_post);
|
||||
trace_migrate_pending_estimate(pending_size, must_precopy, can_postcopy);
|
||||
|
||||
if (pend_pre <= s->threshold_size) {
|
||||
qemu_savevm_state_pending_exact(&pend_pre, &pend_post);
|
||||
pending_size = pend_pre + pend_post;
|
||||
trace_migrate_pending_exact(pending_size, pend_pre, pend_post);
|
||||
if (must_precopy <= s->threshold_size) {
|
||||
qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
|
||||
pending_size = must_precopy + can_postcopy;
|
||||
trace_migrate_pending_exact(pending_size, must_precopy, can_postcopy);
|
||||
}
|
||||
|
||||
if (!pending_size || pending_size < s->threshold_size) {
|
||||
|
@ -3884,7 +3884,7 @@ static MigIterateState migration_iteration_run(MigrationState *s)
|
|||
}
|
||||
|
||||
/* Still a significant amount to transfer */
|
||||
if (!in_postcopy && pend_pre <= s->threshold_size &&
|
||||
if (!in_postcopy && must_precopy <= s->threshold_size &&
|
||||
qatomic_read(&s->start_postcopy)) {
|
||||
if (postcopy_start(s)) {
|
||||
error_report("%s: postcopy failed to start", __func__);
|
||||
|
|
|
@ -3489,9 +3489,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ram_state_pending_estimate(void *opaque,
|
||||
uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
static void ram_state_pending_estimate(void *opaque, uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
RAMState **temp = opaque;
|
||||
RAMState *rs = *temp;
|
||||
|
@ -3500,15 +3499,14 @@ static void ram_state_pending_estimate(void *opaque,
|
|||
|
||||
if (migrate_postcopy_ram()) {
|
||||
/* We can do postcopy, and all the data is postcopiable */
|
||||
*res_postcopy_only += remaining_size;
|
||||
*can_postcopy += remaining_size;
|
||||
} else {
|
||||
*res_precopy_only += remaining_size;
|
||||
*must_precopy += remaining_size;
|
||||
}
|
||||
}
|
||||
|
||||
static void ram_state_pending_exact(void *opaque,
|
||||
uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
static void ram_state_pending_exact(void *opaque, uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
RAMState **temp = opaque;
|
||||
RAMState *rs = *temp;
|
||||
|
@ -3526,9 +3524,9 @@ static void ram_state_pending_exact(void *opaque,
|
|||
|
||||
if (migrate_postcopy_ram()) {
|
||||
/* We can do postcopy, and all the data is postcopiable */
|
||||
*res_postcopy_only += remaining_size;
|
||||
*can_postcopy += remaining_size;
|
||||
} else {
|
||||
*res_precopy_only += remaining_size;
|
||||
*must_precopy += remaining_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1541,13 +1541,13 @@ flush:
|
|||
* the result is split into the amount for units that can and
|
||||
* for units that can't do postcopy.
|
||||
*/
|
||||
void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
SaveStateEntry *se;
|
||||
|
||||
*res_precopy_only = 0;
|
||||
*res_postcopy_only = 0;
|
||||
*must_precopy = 0;
|
||||
*can_postcopy = 0;
|
||||
|
||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||
if (!se->ops || !se->ops->state_pending_estimate) {
|
||||
|
@ -1558,19 +1558,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
se->ops->state_pending_estimate(se->opaque,
|
||||
res_precopy_only,
|
||||
res_postcopy_only);
|
||||
se->ops->state_pending_estimate(se->opaque, must_precopy, can_postcopy);
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only)
|
||||
void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy)
|
||||
{
|
||||
SaveStateEntry *se;
|
||||
|
||||
*res_precopy_only = 0;
|
||||
*res_postcopy_only = 0;
|
||||
*must_precopy = 0;
|
||||
*can_postcopy = 0;
|
||||
|
||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||
if (!se->ops || !se->ops->state_pending_exact) {
|
||||
|
@ -1581,9 +1579,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
se->ops->state_pending_exact(se->opaque,
|
||||
res_precopy_only,
|
||||
res_postcopy_only);
|
||||
se->ops->state_pending_exact(se->opaque, must_precopy, can_postcopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ void qemu_savevm_state_cleanup(void);
|
|||
void qemu_savevm_state_complete_postcopy(QEMUFile *f);
|
||||
int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
|
||||
bool inactivate_disks);
|
||||
void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only);
|
||||
void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
||||
uint64_t *res_postcopy_only);
|
||||
void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy);
|
||||
void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
|
||||
uint64_t *can_postcopy);
|
||||
void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
|
||||
void qemu_savevm_send_open_return_path(QEMUFile *f);
|
||||
int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue