From dfc79b17111251d27f7f5e666242e7a96d8a2835 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Thu, 10 Oct 2024 17:31:51 +0000 Subject: [PATCH] engines/io_uring_cmd: add option to set DEAC bit for write zeroes Add an option for fio to set the DEAC bit for write zeroes commands. This instructs the device to also deallocate the specified logical blocks in the course of completing the write zeroes operation. This only has an effect when write_mode=zeroes is specified. Signed-off-by: Vincent Fu --- engines/io_uring.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/engines/io_uring.c b/engines/io_uring.c index 1b6a4346..60b4f653 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -104,6 +104,7 @@ struct ioring_options { unsigned int hipri; unsigned int readfua; unsigned int writefua; + unsigned int deac; unsigned int write_mode; unsigned int verify_mode; struct cmdprio_options cmdprio_options; @@ -357,6 +358,16 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_IOURING, }, + { + .name = "deac", + .lname = "Deallocate bit for write zeroes command", + .type = FIO_OPT_BOOL, + .off1 = offsetof(struct ioring_options, deac), + .help = "Set DEAC (deallocate) flag for write zeroes command", + .def = "0", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_IOURING, + }, { .name = NULL, }, @@ -1388,6 +1399,8 @@ static int fio_ioring_init(struct thread_data *td) break; case FIO_URING_CMD_WMODE_ZEROES: ld->write_opcode = nvme_cmd_write_zeroes; + if (o->deac) + ld->cdw12_flags[DDIR_WRITE] = 1 << 25; break; case FIO_URING_CMD_WMODE_VERIFY: ld->write_opcode = nvme_cmd_verify; -- 2.25.1