migration: introduce self_announce_delay()
This patch introduces self_announce_delay() to calculate the delay for the next announce round. This could be used by other device e.g virtio-net who wants to do announcing by itself. Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
110f463062
commit
508e1180d3
@ -780,4 +780,12 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
|
||||
void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
|
||||
void vmstate_register_ram_global(struct MemoryRegion *memory);
|
||||
|
||||
static inline
|
||||
int64_t self_announce_delay(int round)
|
||||
{
|
||||
assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
|
||||
/* delay 50ms, 150ms, 250ms, ... */
|
||||
return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
2
savevm.c
2
savevm.c
@ -97,7 +97,7 @@ static void qemu_announce_self_once(void *opaque)
|
||||
if (--count) {
|
||||
/* delay 50ms, 150ms, 250ms, ... */
|
||||
timer_mod(timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) +
|
||||
50 + (SELF_ANNOUNCE_ROUNDS - count - 1) * 100);
|
||||
self_announce_delay(count));
|
||||
} else {
|
||||
timer_del(timer);
|
||||
timer_free(timer);
|
||||
|
Loading…
Reference in New Issue
Block a user