[PATCH 4/9] fio: support NVMe streams

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make small adjustments to the code supporting FDP to accommodate NVMe
streams.

Signed-off-by: Vincent Fu <vincent.fu@xxxxxxxxxxx>
---
 dataplacement.c | 16 +++++++++++++++-
 dataplacement.h |  7 ++++---
 filesetup.c     |  2 +-
 io_u.c          |  2 +-
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/dataplacement.c b/dataplacement.c
index a7170863..a409b825 100644
--- a/dataplacement.c
+++ b/dataplacement.c
@@ -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;
 }
diff --git a/dataplacement.h b/dataplacement.h
index b6ceb5bc..b5718c86 100644
--- a/dataplacement.h
+++ b/dataplacement.h
@@ -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
diff --git a/filesetup.c b/filesetup.c
index 6fbfced5..cb42a852 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -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 e9b94c48..1f4d7af5 100644
--- 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) {
-- 
2.43.0





[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux