* If we have a mixed random workload, we may
* encounter blocks we already did IO to.
*/
- if ((td->o.ddir_nr == 1) && !random_map_free(f, block))
+ if ((td->o.ddir_nr == 1) && !random_map_free(f, block)) {
+ if (!blocks)
+ blocks = 1;
break;
+ }
idx = RAND_MAP_IDX(f, block);
bit = RAND_MAP_BIT(f, block);
f->file_map[idx] |= mask;
nr_blocks -= this_blocks;
blocks += this_blocks;
+ block += this_blocks;
}
if ((blocks * min_bs) < io_u->buflen)
max_bytes = td->this_io_bytes[ddir];
if (max_bytes >=
(td->o.size * td->o.rwmix[ddir] / 100)) {
- if (!td->rw_end_set[ddir])
+ if (!td->rw_end_set[ddir]) {
td->rw_end_set[ddir] = 1;
+ fio_gettime(&td->rw_end[ddir], NULL);
+ }
ddir ^= 1;
}
put_file_log(td, io_u->file);
io_u->file = NULL;
- list_del(&io_u->list);
- list_add(&io_u->list, &td->io_u_freelist);
+ flist_del(&io_u->list);
+ flist_add(&io_u->list, &td->io_u_freelist);
td->cur_depth--;
}
__io_u->flags &= ~IO_U_F_FLIGHT;
- list_del(&__io_u->list);
- list_add_tail(&__io_u->list, &td->io_u_requeues);
+ flist_del(&__io_u->list);
+ flist_add_tail(&__io_u->list, &td->io_u_requeues);
td->cur_depth--;
*io_u = NULL;
}
{
struct io_u *io_u = NULL;
- if (!list_empty(&td->io_u_requeues))
- io_u = list_entry(td->io_u_requeues.next, struct io_u, list);
+ if (!flist_empty(&td->io_u_requeues))
+ io_u = flist_entry(td->io_u_requeues.next, struct io_u, list);
else if (!queue_full(td)) {
- io_u = list_entry(td->io_u_freelist.next, struct io_u, list);
+ io_u = flist_entry(td->io_u_freelist.next, struct io_u, list);
io_u->buflen = 0;
io_u->resid = 0;
io_u->flags &= ~IO_U_F_FREE;
io_u->error = 0;
- list_del(&io_u->list);
- list_add(&io_u->list, &td->io_u_busylist);
+ flist_del(&io_u->list);
+ flist_add(&io_u->list, &td->io_u_busylist);
td->cur_depth++;
}
{
struct thread_data *td, *__td;
pid_t pid = getpid();
- struct list_head *entry;
+ struct flist_head *entry;
struct io_u *io_u;
int i;
log_err("fio: io_u timeout: job=%s, pid=%d\n", td->o.name, td->pid);
- list_for_each(entry, &td->io_u_busylist) {
- io_u = list_entry(entry, struct io_u, list);
+ flist_for_each(entry, &td->io_u_busylist) {
+ io_u = flist_entry(entry, struct io_u, list);
io_u_dump(io_u);
}