Don't pass more than the queued IO depth in to getevents()
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index debcac5eea9edeb55eea6ff0488e7389f8a5de14..434b50372832c49952fd2195c4e4377ae3088227 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -536,7 +536,8 @@ sync_done:
                 */
                full = queue_full(td) || ret == FIO_Q_BUSY;
                if (full || !td->o.iodepth_batch_complete) {
                 */
                full = queue_full(td) || ret == FIO_Q_BUSY;
                if (full || !td->o.iodepth_batch_complete) {
-                       min_events = td->o.iodepth_batch_complete;
+                       min_events = min(td->o.iodepth_batch_complete,
+                                        td->cur_depth);
                        if (full && !min_events)
                                min_events = 1;
 
                        if (full && !min_events)
                                min_events = 1;
 
@@ -688,7 +689,8 @@ sync_done:
                 */
                full = queue_full(td) || ret == FIO_Q_BUSY;
                if (full || !td->o.iodepth_batch_complete) {
                 */
                full = queue_full(td) || ret == FIO_Q_BUSY;
                if (full || !td->o.iodepth_batch_complete) {
-                       min_evts = td->o.iodepth_batch_complete;
+                       min_evts = min(td->o.iodepth_batch_complete,
+                                       td->cur_depth);
                        if (full && !min_evts)
                                min_evts = 1;
 
                        if (full && !min_evts)
                                min_evts = 1;