replay: flush events when exiting
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Wed, 12 Sep 2018 08:18:59 +0000 (11:18 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Oct 2018 17:08:51 +0000 (19:08 +0200)
This patch adds events processing when emulation finishes instead
of just cleaning the queue. Now the bdrv coroutines will be in consistent
state when emulator closes. It allows correct polling of the block layer
at exit.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Message-Id: <20180912081859.3228.79735.stgit@pasha-VirtualBox>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
replay/replay-events.c
replay/replay-internal.h

index 707de3867bbff09a9d937227f617456219d95bba..0964a8283887697c09bae508364dffa6dca148c4 100644 (file)
@@ -94,18 +94,6 @@ void replay_disable_events(void)
     }
 }
 
-void replay_clear_events(void)
-{
-    g_assert(replay_mutex_locked());
-
-    while (!QTAILQ_EMPTY(&events_list)) {
-        Event *event = QTAILQ_FIRST(&events_list);
-        QTAILQ_REMOVE(&events_list, event, events);
-
-        g_free(event);
-    }
-}
-
 /*! Adds specified async event to the queue */
 void replay_add_event(ReplayAsyncEventKind event_kind,
                       void *opaque,
@@ -308,7 +296,7 @@ void replay_init_events(void)
 void replay_finish_events(void)
 {
     events_enabled = false;
-    replay_clear_events();
+    replay_flush_events();
 }
 
 bool replay_events_enabled(void)
index ac4b27b674cc5807878a5093bc36475f11934c98..9b0fd916a367dcc899bd3d0b6f1d237372f01d3f 100644 (file)
@@ -142,8 +142,6 @@ void replay_init_events(void);
 void replay_finish_events(void);
 /*! Flushes events queue */
 void replay_flush_events(void);
-/*! Clears events list before loading new VM state */
-void replay_clear_events(void);
 /*! Returns true if there are any unsaved events in the queue */
 bool replay_has_events(void);
 /*! Saves events from queue into the file */