aboutsummaryrefslogtreecommitdiff
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorKeqian Zhu <zhukeqian1@huawei.com>2020-02-04 13:08:41 +0800
committerJuan Quintela <quintela@redhat.com>2020-02-13 10:53:10 +0100
commitd05de9e39a5fb5582a875a95c4b9c2c8584ea694 (patch)
treef18f452e1fa2ce6635b3e86d86a768368db0a23f /migration/savevm.c
parent8958338b10abcb346b54a8038a491fda2db1c853 (diff)
migration: Optimization about wait-unplug migration state
qemu_savevm_nr_failover_devices() is originally designed to get the number of failover devices, but it actually returns the number of "unplug-pending" failover devices now. Moreover, what drives migration state to wait-unplug should be the number of "unplug-pending" failover devices, not all failover devices. We can also notice that qemu_savevm_state_guest_unplug_pending() and qemu_savevm_nr_failover_devices() is equivalent almost (from the code view). So the latter is incorrect semantically and useless, just delete it. In the qemu_savevm_state_guest_unplug_pending(), once hit a unplug-pending failover device, then it can return true right now to save cpu time. Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Tested-by: Jens Freimann <jfreimann@redhat.com> Reviewed-by: Jens Freimann <jfreimann@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index f19cb9ec7a..1d4220ece8 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1140,36 +1140,18 @@ void qemu_savevm_state_header(QEMUFile *f)
}
}
-int qemu_savevm_nr_failover_devices(void)
+bool qemu_savevm_state_guest_unplug_pending(void)
{
SaveStateEntry *se;
- int n = 0;
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
if (se->vmsd && se->vmsd->dev_unplug_pending &&
se->vmsd->dev_unplug_pending(se->opaque)) {
- n++;
- }
- }
-
- return n;
-}
-
-bool qemu_savevm_state_guest_unplug_pending(void)
-{
- SaveStateEntry *se;
- int n = 0;
-
- QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
- if (!se->vmsd || !se->vmsd->dev_unplug_pending) {
- continue;
- }
- if (se->vmsd->dev_unplug_pending(se->opaque)) {
- n++;
+ return true;
}
}
- return n > 0;
+ return false;
}
void qemu_savevm_state_setup(QEMUFile *f)