fio: support NVMe streams
authorVincent Fu <vincent.fu@samsung.com>
Wed, 17 Jan 2024 15:19:07 +0000 (15:19 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 24 Apr 2024 17:44:09 +0000 (13:44 -0400)
Make small adjustments to the code supporting FDP to accommodate NVMe
streams.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
dataplacement.c
dataplacement.h
filesetup.c
io_u.c

index a7170863937c7a914c90af23dc6fff3668bff592..a409b8250f7be6ccfe4b7e987478c4f3fb855984 100644 (file)
@@ -49,6 +49,20 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f)
        if (!ruhs)
                return -ENOMEM;
 
+       /* set up the data structure used for FDP to work with the supplied stream IDs */
+       if (td->o.dp_type == FIO_DP_STREAMS) {
+               if (!td->o.dp_nr_ids) {
+                       log_err("fio: stream IDs must be provided for dataplacement=streams\n");
+                       return -EINVAL;
+               }
+               ruhs->nr_ruhs = td->o.dp_nr_ids;
+               for (int i = 0; i < ruhs->nr_ruhs; i++)
+                       ruhs->plis[i] = td->o.dp_ids[i];
+
+               f->ruhs_info = ruhs;
+               return 0;
+       }
+
        ret = fdp_ruh_info(td, f, ruhs);
        if (ret) {
                log_info("fio: ruh info failed for %s (%d)\n",
@@ -129,6 +143,6 @@ void dp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)
                dspec = ruhs->plis[ruhs->pli_loc];
        }
 
-       io_u->dtype = FDP_DIR_DTYPE;
+       io_u->dtype = td->o.dp_type == FIO_DP_FDP ? FDP_DIR_DTYPE : STREAMS_DIR_DTYPE;
        io_u->dspec = dspec;
 }
index b6ceb5bcefb6cef92f39890b5bbdc998c4ee165e..b5718c869e7dbadd2ab68e90b331f65914f0fb92 100644 (file)
@@ -3,9 +3,10 @@
 
 #include "io_u.h"
 
-#define FDP_DIR_DTYPE  2
-#define FDP_MAX_RUHS   128
-#define FIO_MAX_DP_IDS         16
+#define STREAMS_DIR_DTYPE      1
+#define FDP_DIR_DTYPE          2
+#define FDP_MAX_RUHS           128
+#define FIO_MAX_DP_IDS                 16
 
 /*
  * How fio chooses what placement identifier to use next. Choice of
index 6fbfced57455bc3e8856c23d57bcd18effc909fb..cb42a852c8cf3728571e54f55103e17d802ef4c4 100644 (file)
@@ -1411,7 +1411,7 @@ done:
 
        td_restore_runstate(td, old_state);
 
-       if (td->o.dp_type == FIO_DP_FDP) {
+       if (td->o.dp_type != FIO_DP_NONE) {
                err = dp_init(td);
                if (err)
                        goto err_out;
diff --git a/io_u.c b/io_u.c
index 86ad74245a5e72a333e3c330c06ecdf42d314c64..a090e12122642f238569f9fa663ab44d5091bef6 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1065,7 +1065,7 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)
                }
        }
 
-       if (td->o.dp_type == FIO_DP_FDP)
+       if (td->o.dp_type != FIO_DP_NONE)
                dp_fill_dspec_data(td, io_u);
 
        if (io_u->offset + io_u->buflen > io_u->file->real_file_size) {