Re: [PATCH v4 2/7] scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices

From: Damien Le Moal
Date: Mon Mar 04 2024 - 18:38:06 EST


On 3/5/24 07:08, Igor Pylypiv wrote:
> Libata sysfs attributes cannot be used for libsas managed SATA devices
> because the ata_port location is different for libsas.
>
> Defined sysfs attributes (visible for SATA devices only):
> - /sys/block/sda/device/ncq_prio_enable
> - /sys/block/sda/device/ncq_prio_supported
>
> The newly defined attributes will pass the correct ata_port to libata
> helper functions.
>
> Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx>
> Signed-off-by: Igor Pylypiv <ipylypiv@xxxxxxxxxx>
> ---
> drivers/scsi/libsas/sas_ata.c | 94 +++++++++++++++++++++++++++++++++++
> include/scsi/sas_ata.h | 6 +++
> 2 files changed, 100 insertions(+)
>
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 12e2653846e3..4ecdfa2a12c3 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -964,3 +964,97 @@ int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, int force_phy_id)
> force_phy_id, &tmf_task);
> }
> EXPORT_SYMBOL_GPL(sas_execute_ata_cmd);
> +
> +static ssize_t sas_ncq_prio_supported_show(struct device *device,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct scsi_device *sdev = to_scsi_device(device);
> + struct domain_device *ddev = sdev_to_domain_dev(sdev);
> + bool supported;
> + int rc;
> +
> + /* This attribute shall be visible for SATA devices only */
> + if (WARN_ON(!dev_is_sata(ddev)))

WARN_ON_ONCE() please. Same comment for all the occurences of this check.

With that, looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

--
Damien Le Moal
Western Digital Research