READ(10) and WRITE(10) are sufficient for zoned UFS devices. UFS device manufacturers prefer to minimize the size of their firmware and hence also the number of SCSI commands that are supported. Hence this patch that switches from READ(16)/WRITE(16)/SYNCHRONIZE CACHE(16) to READ(10)/ WRITE(10)/SYNCHRONIZE CACHE(10) for zoned UFS devices. The 16-byte commands are still used for zoned devices with more than 2**32 logical blocks because of the following code in sd_read_capacity(): if (sdkp->capacity > 0xffffffff) sdp->use_16_for_rw = 1; Cc: Damien Le Moal <dlemoal@xxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- drivers/ata/libata-scsi.c | 10 ++++++++-- drivers/scsi/sd_zbc.c | 5 ----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 0a0f483124c3..a196dce4bbc3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -986,8 +986,14 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc) void ata_scsi_sdev_config(struct scsi_device *sdev) { - sdev->use_10_for_rw = 1; - sdev->use_10_for_ms = 1; + if (sdev->type == TYPE_ZBC) { + /* READ16/WRITE16/SYNC16 is mandatory for ZBC devices */ + sdev->use_16_for_rw = 1; + sdev->use_16_for_sync = 1; + } else { + sdev->use_10_for_rw = 1; + sdev->use_10_for_ms = 1; + } sdev->no_write_same = 1; /* Schedule policy is determined by ->qc_defer() callback and diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 26af5ab7d7c1..bcdb21706d3f 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -924,11 +924,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, u8 buf[SD_BUF_SIZE]) return 0; } - /* READ16/WRITE16/SYNC16 is mandatory for ZBC devices */ - sdkp->device->use_16_for_rw = 1; - sdkp->device->use_10_for_rw = 0; - sdkp->device->use_16_for_sync = 1; - /* Check zoned block device characteristics (unconstrained reads) */ ret = sd_zbc_check_zoned_characteristics(sdkp, buf); if (ret)