Re: [PATCH] ata: libata-sata: Simplify ata_change_queue_depth()

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

 



On 01/06/2023 23:26, Damien Le Moal wrote:
Commit 141f3d6256e5 ("ata: libata-sata: Fix device queue depth control")
added a struct ata_device argument to ata_change_queue_depth() to
address problems with changing the queue depth of ATA devices managed
through libsas. This was due to problems with ata_scsi_find_dev() which
are now fixed with commit 7f875850f20a ("ata: libata-scsi: Use correct
device no in ata_find_dev()").

Undo some of the changes of commit 141f3d6256e5: remove the added struct
ata_device aregument and use again ata_scsi_find_dev() to find the
target ATA device structure. While doing this, also make sure that
ata_scsi_find_dev() is called with ap->lock held, as it should.

libsas and libata call sites of ata_change_queue_depth() are updated to
match the modified function arguments.

Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx>

Thanks!

Just a reminder to all - I'm not asking anyone to fix it - we still have that funky libsas behaviour for attempting to set queue depth at 33:

https://lore.kernel.org/linux-scsi/db84e61a-1069-982a-5659-297fcffc14f4@xxxxxxxxxx/

---
  drivers/ata/libata-sata.c           | 19 ++++++++++---------
  drivers/scsi/libsas/sas_scsi_host.c |  3 +--
  include/linux/libata.h              |  4 ++--
  3 files changed, 13 insertions(+), 13 deletions(-)


...

+			   int queue_depth)
  {
+	struct ata_device *dev;
  	unsigned long flags;
- if (!dev || !ata_dev_enabled(dev))
-		return sdev->queue_depth;
+	spin_lock_irqsave(ap->lock, flags);
- if (queue_depth < 1 || queue_depth == sdev->queue_depth)
+	dev = ata_scsi_find_dev(ap, sdev);
+	if (!dev || queue_depth < 1 || queue_depth == sdev->queue_depth) {
+		spin_unlock_irqrestore(ap->lock, flags);
  		return sdev->queue_depth;
+	}

  	/* NCQ enabled? */
-	spin_lock_irqsave(ap->lock, flags);
  	dev->flags &= ~ATA_DFLAG_NCQ_OFF;
  	if (queue_depth == 1 || !ata_ncq_enabled(dev)) {

Apart from this change, should we call ata_ncq_supported() here (instead of ata_ncq_enabled())? ata_ncq_enabled() checks if ATA_DFLAG_NCQ_OFF is not set, which we have already ensured.

  		dev->flags |= ATA_DFLAG_NCQ_OFF;
  		queue_depth = 1;
  	}
+



[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