Skip to content

Commit

Permalink
engines/io_uring: fdp allocate ruhs buffer as per actual
Browse files Browse the repository at this point in the history
Use calloc instead of scalloc as ruhs buffer allocation is temporary.
Remove the restriction on maximum number of ruhs, fetch and fill the
ruhs buffer as requested by fdp backend.

Signed-off-by: Ankit Kumar <[email protected]>
  • Loading branch information
ankit-sam committed Jul 15, 2024
1 parent d6350b2 commit ddbc0c0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions engines/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,10 +1533,12 @@ static int fio_ioring_cmd_fetch_ruhs(struct thread_data *td, struct fio_file *f,
struct fio_ruhs_info *fruhs_info)
{
struct nvme_fdp_ruh_status *ruhs;
int bytes, ret, i;
int bytes, nr_ruhs, ret, i;

bytes = sizeof(*ruhs) + FDP_MAX_RUHS * sizeof(struct nvme_fdp_ruh_status_desc);
ruhs = scalloc(1, bytes);
nr_ruhs = fruhs_info->nr_ruhs;
bytes = sizeof(*ruhs) + fruhs_info->nr_ruhs * sizeof(struct nvme_fdp_ruh_status_desc);

ruhs = calloc(1, bytes);
if (!ruhs)
return -ENOMEM;

Expand All @@ -1545,12 +1547,10 @@ static int fio_ioring_cmd_fetch_ruhs(struct thread_data *td, struct fio_file *f,
goto free;

fruhs_info->nr_ruhs = le16_to_cpu(ruhs->nruhsd);
if (fruhs_info->nr_ruhs > FDP_MAX_RUHS)
fruhs_info->nr_ruhs = FDP_MAX_RUHS;
for (i = 0; i < fruhs_info->nr_ruhs; i++)
for (i = 0; i < nr_ruhs; i++)
fruhs_info->plis[i] = le16_to_cpu(ruhs->ruhss[i].pid);
free:
sfree(ruhs);
free(ruhs);
return ret;
}

Expand Down

0 comments on commit ddbc0c0

Please sign in to comment.