X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fsg.c;fp=engines%2Fsg.c;h=b51edb078bbb06a04ce63130bdabf1d9586ed0e9;hp=d15b438fdc1a067a252ce0379ddcbb20c836d656;hb=9917adb5d3b9c480ac710af4bc2c9c0421c6a5df;hpb=eadf32608213dc2a44303fce0b417fbb95d1a0a6 diff --git a/engines/sg.c b/engines/sg.c index d15b438f..b51edb07 100644 --- a/engines/sg.c +++ b/engines/sg.c @@ -69,6 +69,7 @@ enum { FIO_SG_WRITE_VERIFY, FIO_SG_WRITE_SAME, FIO_SG_WRITE_SAME_NDOB, + FIO_SG_WRITE_STREAM, FIO_SG_VERIFY_BYTCHK_00, FIO_SG_VERIFY_BYTCHK_01, FIO_SG_VERIFY_BYTCHK_11, @@ -80,6 +81,7 @@ struct sg_options { unsigned int readfua; unsigned int writefua; unsigned int write_mode; + uint16_t stream_id; }; static struct fio_option options[] = { @@ -158,10 +160,24 @@ static struct fio_option options[] = { .oval = FIO_SG_VERIFY_BYTCHK_11, .help = "Issue SCSI VERIFY commands with BYTCHK set to 11", }, + { .ival = "write_stream", + .oval = FIO_SG_WRITE_STREAM, + .help = "Issue SCSI WRITE STREAM(16) commands", + }, }, .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_SG, }, + { + .name = "stream_id", + .lname = "stream id for WRITE STREAM(16) commands", + .type = FIO_OPT_INT, + .off1 = offsetof(struct sg_options, stream_id), + .help = "Stream ID for WRITE STREAM(16) commands", + .def = "0", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_SG, + }, { .name = NULL, }, @@ -611,6 +627,14 @@ static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u) hdr->cmdp[1] |= 0x1; // no data output buffer hdr->dxfer_len = 0; break; + case FIO_SG_WRITE_STREAM: + hdr->cmdp[0] = 0x9a; // write stream (16) + if (o->writefua) + hdr->cmdp[1] |= 0x08; + sgio_set_be64(lba, &hdr->cmdp[2]); + sgio_set_be16(o->stream_id, &hdr->cmdp[10]); + sgio_set_be16((uint16_t) nr_blocks, &hdr->cmdp[12]); + break; case FIO_SG_VERIFY_BYTCHK_00: if (lba < MAX_10B_LBA) hdr->cmdp[0] = 0x2f; // VERIFY(10) @@ -635,8 +659,9 @@ static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u) break; }; - fio_sgio_rw_lba(hdr, lba, nr_blocks, - o->write_mode == FIO_SG_WRITE_SAME_NDOB); + if (o->write_mode != FIO_SG_WRITE_STREAM) + 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;