From ecc734c6b20f2d1729f0da45fb1490ca092f7e85 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Wed, 25 Oct 2023 18:47:45 +0000 Subject: [PATCH] engines/io_uring_cmd: allocate enough ranges for async trims We round up the iodepth to the next highest power of 2. So io_u->index can be greater than the iodepth specified by the user. Make sure we allocate enough of the buffers used to store the ranges for async trim commands when the iodepth specified by the user is not a power of 2. Fixes: 4885a6eba420ce216e4102df3e42229e167d1b7b ("engines/io_uring_cmd: make trims async") Signed-off-by: Vincent Fu --- engines/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 05703df8e3..38c36fdca2 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -1196,7 +1196,7 @@ static int fio_ioring_init(struct thread_data *td) td->o.zone_mode == ZONE_MODE_ZBD) td->io_ops->flags |= FIO_ASYNCIO_SYNC_TRIM; else - ld->dsm = calloc(ld->iodepth, sizeof(*ld->dsm)); + ld->dsm = calloc(td->o.iodepth, sizeof(*ld->dsm)); return 0; }