All of lore.kernel.org
 help / color / mirror / Atom feed
* sd: ZBC Update Read/Write Commands to SCSI spec
@ 2016-05-25 15:02 Petros Koutoupis
  2016-06-01  2:50 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Petros Koutoupis @ 2016-05-25 15:02 UTC (permalink / raw)
  To: hare, linux-scsi; +Cc: petros

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>

--- 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;
--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sd: ZBC Update Read/Write Commands to SCSI spec
  2016-05-25 15:02 sd: ZBC Update Read/Write Commands to SCSI spec Petros Koutoupis
@ 2016-06-01  2:50 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2016-06-01  2:50 UTC (permalink / raw)
  To: Petros Koutoupis; +Cc: hare, linux-scsi

>>>>> "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.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-01  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 15:02 sd: ZBC Update Read/Write Commands to SCSI spec Petros Koutoupis
2016-06-01  2:50 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.