From: Vincent Fu Date: Wed, 25 Oct 2023 18:47:45 +0000 (+0000) Subject: engines/io_uring_cmd: allocate enough ranges for async trims X-Git-Tag: fio-3.37~91 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ecc734c6b20f2d1729f0da45fb1490ca092f7e85;p=fio.git 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 --- diff --git a/engines/io_uring.c b/engines/io_uring.c index 05703df8..38c36fdc 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; }