while (blocks < nr_blocks) {
unsigned int idx, bit;
- if (!random_map_free(td, f, block))
+ /*
+ * If we have a mixed random workload, we may
+ * encounter blocks we already did IO to.
+ */
+ if (!td->o.ddir_nr && !random_map_free(td, f, block))
break;
idx = RAND_MAP_IDX(td, f, block);
unsigned long long max_blocks = f->file_size / td->o.min_bs[ddir];
int loops = 5;
+ if (td->o.ddir_nr) {
+ if (!--td->ddir_nr)
+ td->ddir_nr = td->o.ddir_nr;
+ else {
+ b = f->last_pos / td->o.min_bs[ddir];
+ goto out;
+ }
+ }
+
do {
r = os_random_long(&td->random_state);
if (!max_blocks)
} else
b = f->last_pos / td->o.min_bs[ddir];
+out:
io_u->offset = (b * td->o.min_bs[ddir]) + f->file_offset;
if (io_u->offset >= f->real_file_size)
return 1;
struct io_completion_data icd;
struct timespec *tvp = NULL;
int ret;
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 0, };
- if (!min_events) {
- struct timespec ts = { .tv_sec = 0, .tv_nsec = 0, };
-
+ if (!min_events)
tvp = &ts;
- }
ret = td_io_getevents(td, min_events, td->cur_depth, tvp);
if (ret < 0) {