From 0e3c0070ddf75779c2ef840f6c80f49da9690bdf Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Mon, 15 Jul 2024 21:04:56 +0530 Subject: [PATCH] engines/xnvme: allocate fdp ruhs buffer as per actual Remove the restriction on maximum number of ruhs, fetch and fill the ruhs buffer as requested by fdp backend. Signed-off-by: Ankit Kumar Signed-off-by: Vincent Fu --- engines/xnvme.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/xnvme.c b/engines/xnvme.c index 6ba4aa467..5f1af78d3 100644 --- a/engines/xnvme.c +++ b/engines/xnvme.c @@ -1253,7 +1253,7 @@ static int xnvme_fioe_fetch_ruhs(struct thread_data *td, struct fio_file *f, struct xnvme_dev *dev; struct xnvme_spec_ruhs *ruhs; struct xnvme_cmd_ctx ctx; - uint32_t ruhs_nbytes; + uint32_t ruhs_nbytes, nr_ruhs; uint32_t nsid; int err = 0, err_lock; @@ -1276,7 +1276,8 @@ static int xnvme_fioe_fetch_ruhs(struct thread_data *td, struct fio_file *f, goto exit; } - ruhs_nbytes = sizeof(*ruhs) + (FDP_MAX_RUHS * sizeof(struct xnvme_spec_ruhs_desc)); + nr_ruhs = fruhs_info->nr_ruhs; + ruhs_nbytes = sizeof(*ruhs) + (fruhs_info->nr_ruhs * sizeof(struct xnvme_spec_ruhs_desc)); ruhs = xnvme_buf_alloc(dev, ruhs_nbytes); if (!ruhs) { err = -errno; @@ -1296,7 +1297,7 @@ static int xnvme_fioe_fetch_ruhs(struct thread_data *td, struct fio_file *f, } fruhs_info->nr_ruhs = ruhs->nruhsd; - for (uint32_t idx = 0; idx < fruhs_info->nr_ruhs; ++idx) { + for (uint32_t idx = 0; idx < nr_ruhs; ++idx) { fruhs_info->plis[idx] = le16_to_cpu(ruhs->desc[idx].pi); }