1. 05 Jun, 2023 2 commits
    • Damien Le Moal's avatar
      ata: libata-eh: Use ata_ncq_enabled() in ata_eh_speed_down() · 12980c1f
      Damien Le Moal authored
      In ata_eh_speed_down(), instead of hard-coding the test on the device
      flags to detect if NCQ is supported and enabled, use ata_ncq_enabled().
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      12980c1f
    • Damien Le Moal's avatar
      ata: libata-sata: Improve ata_change_queue_depth() · 45623d33
      Damien Le Moal authored
      ata_change_queue_depth() implements different behaviors for ATA devices
      managed by libsas than for those managed by libata directly.
      Specifically, if a user attempts to set a device queue depth to a value
      larger than 32 (ATA_MAX_QUEUE), the queue depth is capped to the maximum
      and set to 32 for libsas managed devices whereas for libata managed
      devices, the queue depth is unchanged and an error returned to the user.
      This is due to the fact that for libsas devices, sdev->host->can_queue
      may indicate the host (HBA) maximum number of commands that can be
      queued rather than the device maximum queue depth.
      
      Change ata_change_queue_depth() to provide a consistent behavior for all
      devices by changing the queue depth capping code to a check that the
      user provided value does not exceed the device maximum queue depth.
      This check is moved before the code clearing or setting the
      ATA_DFLAG_NCQ_OFF flag to ensure that this flag is not modified when an
      invlaid queue depth is provided.
      
      While at it, two other small improvements are added:
      1) Use ata_ncq_supported() instead of ata_ncq_enabled() and clear the
         ATA_DFLAG_NCQ_OFF flag only and only if needed.
      2) If the user provided queue depth is equal to the current queue depth,
         do not return an error as that is useless.
      
      Overall, the behavior of ata_change_queue_depth() for libata managed
      devices is unchanged. The behavior with libsas managed devices becomes
      consistent with libata managed devices.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      45623d33
  2. 04 Jun, 2023 1 commit
    • Damien Le Moal's avatar
      ata: libata-sata: Simplify ata_change_queue_depth() · 371b74c8
      Damien Le Moal authored
      Commit 141f3d62 ("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 7f875850 ("ata: libata-scsi: Use correct
      device no in ata_find_dev()").
      
      Undo some of the changes of commit 141f3d62: 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: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      371b74c8
  3. 01 Jun, 2023 1 commit
  4. 16 May, 2023 16 commits
  5. 14 May, 2023 14 commits
  6. 13 May, 2023 6 commits