for each command but only the first 512 bytes will be used and
transferred to the device. The writefua option is ignored with this
selection.
+ **write_same_ndob**
+ Issue WRITE SAME(16) commands as above but with the No Data Output
+ Buffer (NDOB) bit set. No data will be transferred to the device with
+ this bit set. Data written will be a pre-determined pattern such as
+ all zeroes.
**verify_bytchk_00**
Issue VERIFY commands with BYTCHK set to 00. This directs the
device to carry out a medium verification with no data comparison.
FIO_SG_WRITE = 1,
FIO_SG_WRITE_VERIFY,
FIO_SG_WRITE_SAME,
+ FIO_SG_WRITE_SAME_NDOB,
FIO_SG_VERIFY_BYTCHK_00,
FIO_SG_VERIFY_BYTCHK_01,
FIO_SG_VERIFY_BYTCHK_11,
.oval = FIO_SG_WRITE_SAME,
.help = "Issue SCSI WRITE SAME commands",
},
+ { .ival = "write_same_ndob",
+ .oval = FIO_SG_WRITE_SAME_NDOB,
+ .help = "Issue SCSI WRITE SAME(16) commands with NDOB flag set",
+ },
{ .ival = "verify_bytchk_00",
.oval = FIO_SG_VERIFY_BYTCHK_00,
.help = "Issue SCSI VERIFY commands with BYTCHK set to 00",
}
static void fio_sgio_rw_lba(struct sg_io_hdr *hdr, unsigned long long lba,
- unsigned long long nr_blocks)
+ unsigned long long nr_blocks, bool override16)
{
- if (lba < MAX_10B_LBA) {
+ if (lba < MAX_10B_LBA && !override16) {
sgio_set_be32((uint32_t) lba, &hdr->cmdp[2]);
sgio_set_be16((uint16_t) nr_blocks, &hdr->cmdp[7]);
} else {
if (o->readfua)
hdr->cmdp[1] |= 0x08;
- fio_sgio_rw_lba(hdr, lba, nr_blocks);
+ fio_sgio_rw_lba(hdr, lba, nr_blocks, false);
} else if (io_u->ddir == DDIR_WRITE) {
sgio_hdr_init(sd, hdr, io_u, 1);
else
hdr->cmdp[0] = 0x93; // write same(16)
break;
+ case FIO_SG_WRITE_SAME_NDOB:
+ hdr->cmdp[0] = 0x93; // write same(16)
+ hdr->cmdp[1] |= 0x1; // no data output buffer
+ hdr->dxfer_len = 0;
+ break;
case FIO_SG_VERIFY_BYTCHK_00:
if (lba < MAX_10B_LBA)
hdr->cmdp[0] = 0x2f; // VERIFY(10)
break;
};
- fio_sgio_rw_lba(hdr, lba, nr_blocks);
+ fio_sgio_rw_lba(hdr, lba, nr_blocks,
+ o->write_mode == FIO_SG_WRITE_SAME_NDOB);
} else if (io_u->ddir == DDIR_TRIM) {
struct sgio_trim *st;
--- /dev/null
+#
+# **********************************
+# * !!THIS IS A DESTRUCTIVE TEST!! *
+# * IF NOT CHANGED THIS TEST WILL *
+# * DESTROY DATA ON /dev/sdb *
+# **********************************
+#
+# Test WRITE SAME commands with the NDOB flag set
+# issued via the sg ioengine
+# All of the jobs below should complete without error
+# except the last one
+#
+# job description
+# precon Precondition the device by writing 20 blocks with a
+# known pattern
+# write_same_ndob Write 19 sectors of all zeroes with the NDOB flag set
+# verify-pass Verify 19 blocks of all zeroes
+# verify-fail Verify 20 blocks of all zeroes. This should fail.
+#
+
+[global]
+filename=/dev/sdb
+buffer_pattern=0x01
+ioengine=sg
+rw=write
+bs=512
+stonewall
+
+[precon]
+number_ios=20
+
+[write_same_ndob]
+sg_write_mode=write_same_ndob
+number_ios=19
+
+[verify-pass]
+sg_write_mode=verify_bytchk_01
+buffer_pattern=0x00
+number_ios=19
+
+[verify-fail]
+sg_write_mode=verify_bytchk_01
+buffer_pattern=0x00
+number_ios=20
be used and transferred to the device. The writefua option is ignored
with this selection.
.TP
+.B write_same_ndob
+Issue WRITE SAME(16) commands as above but with the No Data Output
+Buffer (NDOB) bit set. No data will be transferred to the device with
+this bit set. Data written will be a pre-determined pattern such as
+all zeroes.
+.TP
.B verify_bytchk_00
Issue VERIFY commands with BYTCHK set to 00. This directs the device to carry
out a medium verification with no data comparison.