@@ -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
@@ -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)
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@kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/ata/libata-scsi.c | 10 ++++++++-- drivers/scsi/sd_zbc.c | 5 ----- 2 files changed, 8 insertions(+), 7 deletions(-)