From 481b6e3d93e936be25978bf36705d0fda18a9916 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Wed, 17 Jul 2024 11:27:27 +0530 Subject: [PATCH 1/3] dataplacement: remove FDP_MAX_RUHS Earlier fio used to have different limits on the max number of data placement ID indices which user can pass, and the max number of ruhs which can be stored. As during initialization we now fetch all the ruhs from the device and then allocate buffer for the requested ones, there is no need for FDP_MAX_RUHS. Add missing error message if incorrect placement ID index is specified. Signed-off-by: Ankit Kumar --- dataplacement.c | 13 ++++++------- dataplacement.h | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dataplacement.c b/dataplacement.c index ec1427c843..2286a2cdfd 100644 --- a/dataplacement.c +++ b/dataplacement.c @@ -52,7 +52,7 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) log_err("fio: stream IDs must be provided for dataplacement=streams\n"); return -EINVAL; } - ruhs = scalloc(1, sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(*ruhs->plis)); + ruhs = scalloc(1, sizeof(*ruhs) + FIO_MAX_DP_IDS * sizeof(*ruhs->plis)); if (!ruhs) return -ENOMEM; @@ -94,15 +94,14 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) } if (td->o.dp_nr_ids == 0) { - if (ruhs->nr_ruhs > FDP_MAX_RUHS) - ruhs->nr_ruhs = FDP_MAX_RUHS; + if (ruhs->nr_ruhs > FIO_MAX_DP_IDS) + ruhs->nr_ruhs = FIO_MAX_DP_IDS; } else { - if (td->o.dp_nr_ids > FDP_MAX_RUHS) { - ret = -EINVAL; - goto out; - } for (i = 0; i < td->o.dp_nr_ids; i++) { if (td->o.dp_ids[i] >= ruhs->nr_ruhs) { + log_err("fio: for %s PID index %d must be smaller than %d\n", + f->file_name, td->o.dp_ids[i], + ruhs->nr_ruhs); ret = -EINVAL; goto out; } diff --git a/dataplacement.h b/dataplacement.h index 3267a46040..84b7be5b40 100644 --- a/dataplacement.h +++ b/dataplacement.h @@ -5,7 +5,6 @@ #define STREAMS_DIR_DTYPE 1 #define FDP_DIR_DTYPE 2 -#define FDP_MAX_RUHS 128 #define FIO_MAX_DP_IDS 128 #define DP_MAX_SCHEME_ENTRIES 32 From 6715cca205f814d6cc3e984fed140cfe67ce02f1 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Wed, 17 Jul 2024 19:40:03 +0530 Subject: [PATCH 2/3] dataplacement: change log_info to log_err for error messages Signed-off-by: Ankit Kumar --- dataplacement.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dataplacement.c b/dataplacement.c index 2286a2cdfd..399659beef 100644 --- a/dataplacement.c +++ b/dataplacement.c @@ -71,16 +71,16 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) ruhs = calloc(1, sizeof(*ruhs)); ret = fdp_ruh_info(td, f, ruhs); if (ret) { - log_info("fio: ruh info failed for %s (%d)\n", - f->file_name, -ret); + log_err("fio: ruh info failed for %s (%d)\n", + f->file_name, -ret); goto out; } nr_ruhs = ruhs->nr_ruhs; ruhs = realloc(ruhs, sizeof(*ruhs) + nr_ruhs * sizeof(*ruhs->plis)); if (!ruhs) { - log_info("fio: ruhs buffer realloc failed for %s\n", - f->file_name); + log_err("fio: ruhs buffer realloc failed for %s\n", + f->file_name); ret = -ENOMEM; goto out; } @@ -88,8 +88,8 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) ruhs->nr_ruhs = nr_ruhs; ret = fdp_ruh_info(td, f, ruhs); if (ret) { - log_info("fio: ruh info failed for %s (%d)\n", - f->file_name, -ret); + log_err("fio: ruh info failed for %s (%d)\n", + f->file_name, -ret); goto out; } @@ -151,7 +151,7 @@ static int init_ruh_scheme(struct thread_data *td, struct fio_file *f) if (!scheme_fp) { log_err("fio: ruh scheme failed to open scheme file %s\n", - td->o.dp_scheme_file); + td->o.dp_scheme_file); ret = -errno; goto out; } From 72fb82077a8e9ccd49b349c084d2a96476ea0bd1 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Wed, 17 Jul 2024 12:05:50 +0530 Subject: [PATCH 3/3] ioengines: bump up FIO_IOOPS_VERSION For fdp backend the way ruhs are fetched has been changed. Earlier fdp_fetch_ruhs was called once with a buffer that can store ruhs upto FDP_MAX_RUHS. The new fdp_fetch_ruhs is called twice. The first call doesn't have any buffer for ruhs, and is only to get the number of ruhs reported by the device. The second call has the buffer that can store all the ruhs. This impacts any external ioengines, so bump up FIO_IOOPS_VERSION. Fixes: commit 56d12245 (dataplacement: update ruh info initialization) Signed-off-by: Ankit Kumar --- ioengines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ioengines.h b/ioengines.h index d5b0cafe33..6039d41ef4 100644 --- a/ioengines.h +++ b/ioengines.h @@ -9,7 +9,7 @@ #include "zbd_types.h" #include "dataplacement.h" -#define FIO_IOOPS_VERSION 34 +#define FIO_IOOPS_VERSION 35 #ifndef CONFIG_DYNAMIC_ENGINES #define FIO_STATIC static