Re: [PATCH] scsi/sd_zbc: Use READ(10)/WRITE(10) for zoned UFS devices

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

 



On 2024/02/29 9:23, Bart Van Assche wrote:
> 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;

scsi_add_lun() sets use_10_for_rw to "1" so can we clear it to "0" here again
like was done in the sd_zbc.c hunk below that you removed ?

> +	} 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)

-- 
Damien Le Moal
Western Digital Research





[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