diff mbox

sd: ZBC Update Read/Write Commands to SCSI spec

Message ID 1464188556.3020.4.camel@petroskoutoupis.com (mailing list archive)
State Deferred, archived
Headers show

Commit Message

Petros Koutoupis May 25, 2016, 3:02 p.m. UTC
This patch is based on:
git.kernel.org:/pub/scm/linux/kernel/git/hare/scsi-devel branch zbc.v6

According to the Zoned Block Commands (ZBC) Revision 5 SCSI specification,
a Host Managed and Host Aware device is limited to support at a minimum the
READ (16) and WRITE (16) read/write CDBs. This means that a drive manufacturer
is not obligated to support anything else. We shouldn't assume that we can
send other read/write commands and should instead limit sd to only the
mandatory list highlighted in the specification.

Note, I did not place the a check for zoned devices in the DIF-enabled
conditional above, under the assumption that if the media supports Type-2
then it should also support the 32-byte commands. Thoughts?

Signed-off-by: Petros Koutoupis <petros@petroskoutoupis.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Martin K. Petersen June 1, 2016, 2:50 a.m. UTC | #1
>>>>> "Petros" == Petros Koutoupis <petros@petroskoutoupis.com> writes:

Petros> Note, I did not place the a check for zoned devices in the
Petros> DIF-enabled conditional above, under the assumption that if the
Petros> media supports Type-2 then it should also support the 32-byte
Petros> commands. Thoughts?

That's correct.
diff mbox

Patch

--- scsi-devel/drivers/scsi/sd.c.orig	2016-05-12 23:21:04.314000000 -0500
+++ scsi-devel/drivers/scsi/sd.c	2016-05-25 08:55:21.715506056 -0500
@@ -1159,7 +1159,8 @@  static int sd_setup_read_write_cmnd(stru
 		SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff;
 		SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff;
 		SCpnt->cmnd[31] = (unsigned char) this_count & 0xff;
-	} else if (sdp->use_16_for_rw || (this_count > 0xffff)) {
+	} else if (sdp->use_16_for_rw || (this_count > 0xffff) ||
+		   sdkp->zoned == 1 || sdp->type == TYPE_ZBC) {
 		SCpnt->cmnd[0] += READ_16 - READ_6;
 		SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
 		SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;