libata: Improve ATA queued command allocation
authorJohn Garry <john.garry@huawei.com>
Fri, 8 Apr 2022 09:04:12 +0000 (17:04 +0800)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Mon, 11 Apr 2022 00:27:44 +0000 (09:27 +0900)
commit4f1a22ee7b576a38dc5705837c9b0de0c7b5b064
tree6da76c8edd6a5e5b713cfc639d7e6bae769adbc3
parentc956b92ee19b978bd8da50e30271a0a4c62bea28
libata: Improve ATA queued command allocation

Improve ATA queued command allocation as follows:

- For attaining a qc tag for a SAS host we need to allocate a bit in
  ata_port.sas_tag_allocated bitmap.

  However we already have a unique tag per device in range
  [0, ATA_MAX_QUEUE -1] in the scsi cmnd budget token, so just use that
  instead.

- It is a bit pointless to have ata_qc_new_init() in libata-core.c since it
  pokes scsi internals, so inline it in ata_scsi_qc_new() (in
  libata-scsi.c). Also update Doc accordingly.

- Use standard SCSI helpers set_host_byte() and set_status_byte() in
  ata_scsi_qc_new().

Christoph Hellwig originally contributed the change to inline
ata_qc_new_init().

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Documentation/driver-api/libata.rst
drivers/ata/libata-core.c
drivers/ata/libata-sata.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
include/linux/libata.h