ata: libata-sata: Fix device queue depth control
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sat, 24 Sep 2022 06:18:26 +0000 (15:18 +0900)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Wed, 28 Sep 2022 11:47:31 +0000 (20:47 +0900)
commit141f3d6256e58103ece1c3dd2835e871f1dde240
tree14c975e3ab5818be33bf4f59dd2ff3be7407c52e
parent6a8438de524346f2ac73b0b493980c336ebce688
ata: libata-sata: Fix device queue depth control

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() returns NULL, turning
__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 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@opensource.wdc.com>
Tested-by: John Garry <john.garry@huawei.com>
drivers/ata/libata-sata.c
drivers/scsi/libsas/sas_scsi_host.c
include/linux/libata.h