Skip to content

Commit

Permalink
fio: support NVMe streams
Browse files Browse the repository at this point in the history
Make small adjustments to the code supporting FDP to accommodate NVMe
streams.

Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
vincentkfu committed Apr 24, 2024
1 parent ece3a99 commit 1a3a21b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
16 changes: 15 additions & 1 deletion dataplacement.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}
7 changes: 4 additions & 3 deletions dataplacement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion filesetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ int setup_files(struct thread_data *td)

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;
Expand Down
2 changes: 1 addition & 1 deletion io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1a3a21b

Please sign in to comment.