workqueue: properly account ->cur_depth
[fio.git] / workqueue.c
index 344237538113d8fa01c3707eae156c72869b0d11..27d1060c6e6f2b1cd6710d540e63e9b0c621691c 100644 (file)
@@ -283,8 +283,12 @@ static void *worker_thread(void *data)
 
                        if (td->io_u_queued || td->cur_depth ||
                            td->io_u_in_flight) {
+                               int ret;
+
                                pthread_mutex_unlock(&sw->lock);
-                               io_u_quiesce(td);
+                               ret = io_u_quiesce(td);
+                               if (ret > 0)
+                                       td->cur_depth -= ret;
                                pthread_mutex_lock(&sw->lock);
                        }