axboe / fio

Flexible I/O Tester
GNU General Public License v2.0
5.01k stars 1.23k forks source link

io_uring: Add 'write_mode' option for optional cmds #1766

Closed minwooim closed 1 month ago

minwooim commented 1 month ago

Add a new option 'write_mode' to support additional optional Write command family such as Write Uncorrectable and Write Zeroes in NVMe. Since we have io_uring_cmd ioengine where we can define the actual opcode of the command, this option will be used to test NVMe device with various combination of Write command types.

'write_mode' option can be given either 'write', 'uncor', 'zeroes' or 'verify'. 'write' is for normal Write command which is by default, 'uncor' is for Write Uncorrectable, 'zeroes' for Write Zeroes and 'verify' for Verify command This should be used with DDIR_WRITE ddir.

This patch updates command's opcode in fio_ioring_init() to avoid branches in the I/O hottest path giving opcode value to the fio_nvme_uring_cmd_prep() as an argument.

minwooim commented 1 month ago

@axboe @vincentkfu ,

Can we have a new DDIR only just for io_uring_cmd to support custom commands with an extra option like cmd ? As io_uring_cmd ioengine has enabled flexible testing ways for storage devices by enabling ioengine can specify command descriptor details, it's so useful to test storage device with high and wide coverage. And I would really want to test storage device with various command types which have SLBA and NLB pattern other than typical I/O commands (READ/WRITE/TRIM).

If possible, I would like to introduce a cmd option with --rw=uring_cmd to support various spec-based commands rather than introducing a writetype which is might be too specific for WRITE commands only.

[global]
...
ioengine=io_uring_cmd
cmd_type=nvme
filename=/dev/ng0n1

[job0]
rw=uring_cmd
cmd=writeuncor

[job1]
rw=uring_cmd
cmd=writezeroes
...
vincentkfu commented 1 month ago

There is a similar option for the sg ioengine. Can you adopt that option for io_uring_cmd?

minwooim commented 1 month ago

There is a similar option for the sg ioengine. Can you adopt that option for io_uring_cmd?

That makes sense. I've updated parameter name to write_mode which is used in sg ioengine as sg_write_mode.

vincentkfu commented 1 month ago

The nomenclature here is not ideal because none of verify, write zeroes, and write uncorrectable will actually make use of the data buffer that fio prepares for write operations. By default fio will generate random data for the write buffer one time only. So this is probably not a big deal.

minwooim commented 1 month ago

The nomenclature here is not ideal because none of verify, write zeroes, and write uncorrectable will actually make use of the data buffer that fio prepares for write operations. By default fio will generate random data for the write buffer one time only. So this is probably not a big deal.

Indeed, that's why I've been curious about whether the name of writetype is propero r not since it might be considered as WRITE family, but it might not due to non-data transfer. But, as you suggested in the previous review, I would prefer to have consistent name of write_mode along with sg ioengine for these commands. And yes, even fio prepares the actual DOUT buffer, I think it's not that a big deal not preventing data preparation for them.