engines/io_uring_cmd: add option to set DEAC bit for write zeroes
authorVincent Fu <vincent.fu@samsung.com>
Thu, 10 Oct 2024 17:31:51 +0000 (17:31 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Mon, 28 Oct 2024 16:24:09 +0000 (12:24 -0400)
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 <vincent.fu@samsung.com>
engines/io_uring.c

index 1b6a4346a3e37ec9591d5cf7a3f61fd3f03121ae..60b4f6536e4d8d7f0b27610c69f4fbe01029c1ff 100644 (file)
@@ -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;