struct fio_ruhs_info *ruhs, *tmp;
int i, ret;
- ruhs = scalloc(1, sizeof(*ruhs) + 128 * sizeof(*ruhs->plis));
+ ruhs = scalloc(1, sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(*ruhs->plis));
if (!ruhs)
return -ENOMEM;
goto out;
}
- if (ruhs->nr_ruhs > 128)
- ruhs->nr_ruhs = 128;
+ if (ruhs->nr_ruhs > FDP_MAX_RUHS)
+ ruhs->nr_ruhs = FDP_MAX_RUHS;
if (td->o.fdp_nrpli == 0) {
f->ruhs_info = ruhs;
}
for (i = 0; i < td->o.fdp_nrpli; i++) {
- if (td->o.fdp_plis[i] > ruhs->nr_ruhs) {
+ if (td->o.fdp_plis[i] >= ruhs->nr_ruhs) {
ret = -EINVAL;
goto out;
}
return;
}
- dspec = ruhs->plis[ruhs->pli_loc++ % ruhs->nr_ruhs];
- io_u->dtype = 2;
+ if (td->o.fdp_pli_select == FIO_FDP_RR) {
+ if (ruhs->pli_loc >= ruhs->nr_ruhs)
+ ruhs->pli_loc = 0;
+
+ dspec = ruhs->plis[ruhs->pli_loc++];
+ } else {
+ ruhs->pli_loc = rand_between(&td->fdp_state, 0, ruhs->nr_ruhs - 1);
+ dspec = ruhs->plis[ruhs->pli_loc];
+ }
+
+ io_u->dtype = FDP_DIR_DTYPE;
io_u->dspec = dspec;
}