io_uring: Add support FLUSH command
authorMinwoo Im <minwoo.im.dev@gmail.com>
Sat, 22 Jun 2024 11:35:02 +0000 (20:35 +0900)
committerMinwoo Im <minwoo.im@samsung.com>
Tue, 9 Jul 2024 22:40:16 +0000 (07:40 +0900)
Add support for --fsync and --fdatasync in io_uring_cmd ioengine to
enable FLUSH commands just like libaio or io_uring ioengines.

If --fsync or --fdatasync is given N, FLUSH command will be issued as
per N write commands.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
engines/nvme.c
engines/nvme.h

index 72934c8b1d9172bb1f9e4c19e8fa5e0e1c151a2c..33d874773799d343f711cbf03ed7ac93db20f191 100644 (file)
@@ -381,6 +381,11 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
        case DDIR_TRIM:
                fio_nvme_uring_cmd_trim_prep(cmd, io_u, dsm);
                return 0;
+       case DDIR_SYNC:
+       case DDIR_DATASYNC:
+               cmd->opcode = nvme_cmd_flush;
+               cmd->nsid = data->nsid;
+               return 0;
        default:
                return -ENOTSUP;
        }
index bc2370b8d2a2c11f764a4ce01b80f1a2a3f5ca5d..b5fef2fb2cf822887f57a11072b4a6754a5c8895 100644 (file)
@@ -73,6 +73,7 @@ enum nvme_admin_opcode {
 };
 
 enum nvme_io_opcode {
+       nvme_cmd_flush                  = 0x00,
        nvme_cmd_write                  = 0x01,
        nvme_cmd_read                   = 0x02,
        nvme_cmd_write_uncor            = 0x04,