fdp: use macros
authorAnkit Kumar <ankit.kumar@samsung.com>
Wed, 12 Jul 2023 10:20:38 +0000 (15:50 +0530)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 13 Jul 2023 16:38:14 +0000 (12:38 -0400)
use macros for directive type and max ruhs.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
engines/io_uring.c
fdp.c
fdp.h

index 5021239e147d2cf1dcd851a6dcffe2335307114a..407d65ce22a40ed5c094a90bcab48b363122adfe 100644 (file)
@@ -1310,7 +1310,7 @@ static int fio_ioring_cmd_fetch_ruhs(struct thread_data *td, struct fio_file *f,
        struct nvme_fdp_ruh_status *ruhs;
        int bytes, ret, i;
 
-       bytes = sizeof(*ruhs) + 128 * sizeof(struct nvme_fdp_ruh_status_desc);
+       bytes = sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(struct nvme_fdp_ruh_status_desc);
        ruhs = scalloc(1, bytes);
        if (!ruhs)
                return -ENOMEM;
diff --git a/fdp.c b/fdp.c
index d92dbc67cc05855e1a1fa954cd85c23079427941..b83fd66054c86d2a34b284ab7048e2487a7657c2 100644 (file)
--- a/fdp.c
+++ b/fdp.c
@@ -45,7 +45,7 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f)
        struct fio_ruhs_info *ruhs, *tmp;
        int i, ret;
 
-       ruhs = scalloc(1, sizeof(*ruhs) + 128 * sizeof(*ruhs->plis));
+       ruhs = scalloc(1, sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(*ruhs->plis));
        if (!ruhs)
                return -ENOMEM;
 
@@ -56,8 +56,8 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f)
                goto out;
        }
 
-       if (ruhs->nr_ruhs > 128)
-               ruhs->nr_ruhs = 128;
+       if (ruhs->nr_ruhs > FDP_MAX_RUHS)
+               ruhs->nr_ruhs = FDP_MAX_RUHS;
 
        if (td->o.fdp_nrpli == 0) {
                f->ruhs_info = ruhs;
@@ -123,6 +123,6 @@ void fdp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)
                ruhs->pli_loc = 0;
 
        dspec = ruhs->plis[ruhs->pli_loc++];
-       io_u->dtype = 2;
+       io_u->dtype = FDP_DIR_DTYPE;
        io_u->dspec = dspec;
 }
diff --git a/fdp.h b/fdp.h
index 81691f62ca412ab3d650205136bd39a6eb6d08aa..6ecbfcbe3b5e7b1c2effa9918ef8629c925aaea7 100644 (file)
--- a/fdp.h
+++ b/fdp.h
@@ -3,6 +3,9 @@
 
 #include "io_u.h"
 
+#define FDP_DIR_DTYPE  2
+#define FDP_MAX_RUHS   128
+
 struct fio_ruhs_info {
        uint32_t nr_ruhs;
        uint32_t pli_loc;