sd: ZBC Update Read/Write Commands to SCSI spec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>

--- 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux