[Spice-devel] [PATCH 01/11] dispatcher: remove unused async_commands ring

Frediano Ziglio fziglio at redhat.com
Tue Feb 9 10:27:50 UTC 2016


The only usage of this ring was to have a message when there was no
commands on the list.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-dispatcher.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
index 374d5a9..19fbf61 100644
--- a/server/red-dispatcher.c
+++ b/server/red-dispatcher.c
@@ -42,7 +42,6 @@
 static int num_active_workers = 0;
 
 struct AsyncCommand {
-    RingItem link;
     RedWorkerMessage message;
     uint64_t cookie;
 };
@@ -57,8 +56,6 @@ struct RedDispatcher {
     int y_res;
     int use_hardware_cursor;
     RedDispatcher *next;
-    Ring async_commands;
-    pthread_mutex_t  async_lock;
     QXLDevSurfaceCreate surface_create;
     unsigned int max_monitors;
 };
@@ -288,9 +285,6 @@ static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
     async_command->cookie = cookie;
     async_command->message = message;
 
-    pthread_mutex_lock(&dispatcher->async_lock);
-    ring_add(&dispatcher->async_commands, &async_command->link);
-    pthread_mutex_unlock(&dispatcher->async_lock);
     spice_debug("%p", async_command);
     return async_command;
 }
@@ -963,13 +957,7 @@ void spice_qxl_driver_unload(QXLInstance *instance)
 void red_dispatcher_async_complete(struct RedDispatcher *dispatcher,
                                    AsyncCommand *async_command)
 {
-    pthread_mutex_lock(&dispatcher->async_lock);
-    ring_remove(&async_command->link);
     spice_debug("%p: cookie %" PRId64, async_command, async_command->cookie);
-    if (ring_is_empty(&dispatcher->async_commands)) {
-        spice_debug("no more async commands");
-    }
-    pthread_mutex_unlock(&dispatcher->async_lock);
     switch (async_command->message) {
     case RED_WORKER_MESSAGE_UPDATE_ASYNC:
     case RED_WORKER_MESSAGE_ADD_MEMSLOT_ASYNC:
@@ -1010,10 +998,7 @@ void red_dispatcher_init(QXLInstance *qxl)
 
     red_dispatcher = spice_new0(RedDispatcher, 1);
     red_dispatcher->qxl = qxl;
-    ring_init(&red_dispatcher->async_commands);
-    spice_debug("red_dispatcher->async_commands.next %p", red_dispatcher->async_commands.next);
     dispatcher_init(&red_dispatcher->dispatcher, RED_WORKER_MESSAGE_COUNT, NULL);
-    pthread_mutex_init(&red_dispatcher->async_lock, NULL);
     red_dispatcher->base.major_version = SPICE_INTERFACE_QXL_MAJOR;
     red_dispatcher->base.minor_version = SPICE_INTERFACE_QXL_MINOR;
     red_dispatcher->base.wakeup = qxl_worker_wakeup;
-- 
2.5.0



More information about the Spice-devel mailing list