On 9/24/22 18:49, Sergey Shtylyov wrote: > Hello! > > On 9/24/22 9:29 AM, Damien Le Moal wrote: > >> The function __ata_change_queue_depth() uses the helper >> ata_scsi_find_dev() to get the ata_device structure of a scsi device and >> set that device maximum queue depth. However, when the ata device is >> managed by libsas, ata_scsi_find_dev() return NULL, turning > > Returns? > >> __ata_change_queue_depth() into a nop, which prevents the user from >> setting the maximum queue depth of ATA devices used with libsas based >> HBAs. >> >> Fix this by renaming __ata_change_queue_depth() to >> ata_change_queue_depth() and adding a pointer to the ata_device >> structure of the target device as argument. This pointer is provided by >> ata_scsi_change_queue_depth() using ata_scsi_find_dev() in the case ofi > > Of? > >> a libata managed device and by sas_change_queue_depth() using >> sas_to_ata_dev() in the case of a libsas managed ata device. >> >> Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> > [...] > >> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c >> index ff9602a0e54e..c63bb50323c1 100644 >> --- a/drivers/ata/libata-scsi.c >> +++ b/drivers/ata/libata-scsi.c >> @@ -1101,6 +1101,11 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) >> if (dev->flags & ATA_DFLAG_AN) >> set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); >> >> + pr_info("#### can queue %d, ata qd %d, scsi qd %d\n", > > Hm... isn't this a debugging pr_info() call you forgot to remove? Oops. Yes. Sending an update. Thanks for the review. > >> + sdev->host->can_queue, >> + ata_id_queue_depth(dev->id), >> + sdev->queue_depth); >> + >> if (dev->flags & ATA_DFLAG_NCQ) >> depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); >> depth = min(ATA_MAX_QUEUE, depth); > [...] > > MBR, Sergey -- Damien Le Moal Western Digital Research