examples: fiograph plots for dir operation ioengines
[fio.git] / fdp.c
diff --git a/fdp.c b/fdp.c
index b83fd66054c86d2a34b284ab7048e2487a7657c2..49c80d2c613466cf9e5d98171dd4c4bf727ad7a9 100644 (file)
--- a/fdp.c
+++ b/fdp.c
@@ -65,7 +65,7 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f)
        }
 
        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;
                }
@@ -119,10 +119,16 @@ void fdp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)
                return;
        }
 
-       if (ruhs->pli_loc >= ruhs->nr_ruhs)
-               ruhs->pli_loc = 0;
+       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];
+       }
 
-       dspec = ruhs->plis[ruhs->pli_loc++];
        io_u->dtype = FDP_DIR_DTYPE;
        io_u->dspec = dspec;
 }