* completed io_u's first. Note that we can get BUSY even
* without IO queued, if the system is resource starved.
*/
* completed io_u's first. Note that we can get BUSY even
* without IO queued, if the system is resource starved.
*/
full = queue_full(td) || (ret == FIO_Q_BUSY && td->cur_depth);
if (full || !td->o.iodepth_batch_complete) {
min_events = min(td->o.iodepth_batch_complete,
full = queue_full(td) || (ret == FIO_Q_BUSY && td->cur_depth);
if (full || !td->o.iodepth_batch_complete) {
min_events = min(td->o.iodepth_batch_complete,
fio_mutex_down(td->mutex);
dprint(FD_MUTEX, "done waiting on td->mutex\n");
fio_mutex_down(td->mutex);
dprint(FD_MUTEX, "done waiting on td->mutex\n");
td_set_runstate(td, TD_EXITED);
return (void *) (uintptr_t) td->error;
}
td_set_runstate(td, TD_EXITED);
return (void *) (uintptr_t) td->error;
}