For the mixed io types, the default is to split them 50/50.
For certain types of io the result may still be skewed a bit,
- since the speed may be different.
+ since the speed may be different. It is possible to specify
+ a number of IO's to do before getting a new offset - this
+ is only useful for random IO, where fio would normally
+ generate a new random offset for every IO. If you append
+ eg 8 to randread, you would get a new random offset for
+ every 8 IO's. The result would be a seek for only every 8
+ IO's, instead of for every IO. Use rw=randread:8 to specify
+ that.
randrepeat=bool For random IO workloads, seed the generator in a predictable
way so that results are repeatable across repetitions.
char *opendir;
char *ioengine;
enum td_ddir td_ddir;
+ unsigned int ddir_nr;
unsigned int iodepth;
unsigned int iodepth_low;
unsigned int iodepth_batch;
unsigned long long rwmix_bytes;
struct timeval rwmix_switch;
enum fio_ddir rwmix_ddir;
+ unsigned int ddir_nr;
/*
* IO historic logs
while (blocks < nr_blocks) {
unsigned int idx, bit;
- if (!random_map_free(td, f, block))
+ 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 if (--td->ddir_nr) {
+ b = f->last_pos / td->o.min_bs[ddir];
+ goto out;
+ } else
+ td->ddir_nr = td->o.ddir_nr;
+ }
+
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;
return strdup(p);
}
+static int str_rw_cb(void *data, const char *str)
+{
+ struct thread_data *td = data;
+ char *nr = get_opt_postfix(str);
+
+ td->o.ddir_nr = 0;
+ if (nr)
+ td->o.ddir_nr = atoi(nr);
+
+ printf("ddir_nr=%d\n", td->o.ddir_nr);
+
+ return 0;
+}
+
static int str_mem_cb(void *data, const char *mem)
{
struct thread_data *td = data;
.name = "rw",
.alias = "readwrite",
.type = FIO_OPT_STR,
+ .cb = str_rw_cb,
.off1 = td_var_offset(td_ddir),
.help = "IO direction",
.def = "read",