]> Git Repo - qemu.git/commitdiff
thread-pool: clean up thread_pool_completion_bh()
authorStefan Hajnoczi <[email protected]>
Thu, 2 Apr 2015 16:39:22 +0000 (17:39 +0100)
committerKevin Wolf <[email protected]>
Tue, 28 Apr 2015 13:36:09 +0000 (15:36 +0200)
This patch simplifies thread_pool_completion_bh().

The function first checks elem->state:

  if (elem->state != THREAD_DONE) {
      continue;
  }

It then goes on to check elem->state == THREAD_DONE although we already
know this must be the case.

The QLIST_REMOVE() is duplicated down both branches of an if-else
statement so that can be lifted out as well.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Message-id: 1427992762[email protected]
Signed-off-by: Kevin Wolf <[email protected]>
thread-pool.c

index e2cac8e4ffda23495e5c430e994f64ae26dde2b3..ac909f498675325f689747b636300146bdb251f6 100644 (file)
@@ -170,12 +170,12 @@ restart:
         if (elem->state != THREAD_DONE) {
             continue;
         }
-        if (elem->state == THREAD_DONE) {
-            trace_thread_pool_complete(pool, elem, elem->common.opaque,
-                                       elem->ret);
-        }
-        if (elem->state == THREAD_DONE && elem->common.cb) {
-            QLIST_REMOVE(elem, all);
+
+        trace_thread_pool_complete(pool, elem, elem->common.opaque,
+                                   elem->ret);
+        QLIST_REMOVE(elem, all);
+
+        if (elem->common.cb) {
             /* Read state before ret.  */
             smp_rmb();
 
@@ -188,8 +188,6 @@ restart:
             qemu_aio_unref(elem);
             goto restart;
         } else {
-            /* remove the request */
-            QLIST_REMOVE(elem, all);
             qemu_aio_unref(elem);
         }
     }
This page took 0.0279 seconds and 4 git commands to generate.