engines/io_uring_cmd: allocate enough ranges for async trims
authorVincent Fu <vincent.fu@samsung.com>
Wed, 25 Oct 2023 18:47:45 +0000 (18:47 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 25 Oct 2023 19:34:38 +0000 (15:34 -0400)
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 <vincent.fu@samsung.com>
engines/io_uring.c

index 05703df8e357beda82e4b7d331345d978611eddd..38c36fdca26063fcbb8aacbda7a9b1ec71fb655b 100644 (file)
@@ -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;
 }