2 * Note: This is similar to a very basic setup
5 * Specify fdp=1 (With char devices /dev/ng0n1)
18 static int fdp_ruh_info(struct thread_data *td, struct fio_file *f,
19 struct fio_ruhs_info *ruhs)
24 log_err("fio: no ops set in fdp init?!\n");
28 if (td->io_ops->fdp_fetch_ruhs) {
29 ret = td->io_ops->fdp_fetch_ruhs(td, f, ruhs);
31 td_verror(td, errno, "fdp fetch ruhs failed");
32 log_err("%s: fdp fetch ruhs failed (%d)\n",
36 log_err("%s: engine (%s) lacks fetch ruhs\n",
37 f->file_name, td->io_ops->name);
43 static int init_ruh_info(struct thread_data *td, struct fio_file *f)
45 struct fio_ruhs_info *ruhs, *tmp;
48 ruhs = scalloc(1, sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(*ruhs->plis));
52 ret = fdp_ruh_info(td, f, ruhs);
54 log_info("fio: ruh info failed for %s (%d)\n",
59 if (ruhs->nr_ruhs > FDP_MAX_RUHS)
60 ruhs->nr_ruhs = FDP_MAX_RUHS;
62 if (td->o.fdp_nrpli == 0) {
67 for (i = 0; i < td->o.fdp_nrpli; i++) {
68 if (td->o.fdp_plis[i] >= ruhs->nr_ruhs) {
74 tmp = scalloc(1, sizeof(*tmp) + ruhs->nr_ruhs * sizeof(*tmp->plis));
80 tmp->nr_ruhs = td->o.fdp_nrpli;
81 for (i = 0; i < td->o.fdp_nrpli; i++)
82 tmp->plis[i] = ruhs->plis[td->o.fdp_plis[i]];
89 int fdp_init(struct thread_data *td)
94 for_each_file(td, f, i) {
95 ret = init_ruh_info(td, f);
102 void fdp_free_ruhs_info(struct fio_file *f)
110 void fdp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)
112 struct fio_file *f = io_u->file;
113 struct fio_ruhs_info *ruhs = f->ruhs_info;
116 if (!ruhs || io_u->ddir != DDIR_WRITE) {
122 if (td->o.fdp_pli_select == FIO_FDP_RR) {
123 if (ruhs->pli_loc >= ruhs->nr_ruhs)
126 dspec = ruhs->plis[ruhs->pli_loc++];
128 ruhs->pli_loc = rand_between(&td->fdp_state, 0, ruhs->nr_ruhs - 1);
129 dspec = ruhs->plis[ruhs->pli_loc];
132 io_u->dtype = FDP_DIR_DTYPE;