engines/sg: add support for WRITE AND VERIFY, WRITE SAME
authorVincent Fu <vincent.fu@wdc.com>
Wed, 16 May 2018 23:17:47 +0000 (19:17 -0400)
committerVincent Fu <vincent.fu@wdc.com>
Fri, 18 May 2018 17:49:23 +0000 (13:49 -0400)
commitcbdc9353da4ca4522cbed59e98d796a9ca99f0e9
tree35f5bb9c4b0ce18cfb71743e3ff338d0e9a612a3
parent5eac3b00238b450ac0679121a76f1e566ca8f468
engines/sg: add support for WRITE AND VERIFY, WRITE SAME

Add an sg ioengine option to treat write IO as either WRITE AND VERIFY
or WRITE SAME commands

The new ioengine option sg_write_mode can take 3 values:

write (default)
  WRITE opcodes are issued as usual
verify
  WRITE AND VERIFY opcodes are issued
same
  WRITE SAME opcodes are issued

WRITE AND VERIFY opcodes are issued with the BYTCHK bit set to 0. This
directs the device to carry out a medium verification with no data
comparison.

WRITE SAME transfers a single block of data to the device and writes
this same block of data to a contiguous sequence of LBAs beginning at
the specified offset.

fio's block size parameter specifies the amount of data written with
each command. However, the amount of data actually transferred to the
device is equal to the device's block (sector) size. For a device with
512 byte sectors, blocksize=8k will write 16 sectors with each command.
fio will still generate 8k of data for each command but only the first
512 bytes will be used and transferred to the device.
engines/sg.c