Since a single hardware queue is used by ATA drivers, the request tag uniquely identifies in-flight commands. Stop using the SCSI budget token to prepare for no longer allocating a budget token if possible. The modified code was introduced by commit 4f1a22ee7b57 ("libata: Improve ATA queued command allocation"). Cc: Damien Le Moal Cc: Niklas Cassel Cc: John Garry Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/ata/libata-scsi.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 026122bb6f2f..90f5422fa08b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -744,22 +744,16 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, { struct ata_port *ap = dev->link->ap; struct ata_queued_cmd *qc; - int tag; + int tag = scsi_cmd_to_rq(cmd)->tag; if (unlikely(ata_port_is_frozen(ap))) goto fail; - if (ap->flags & ATA_FLAG_SAS_HOST) { - /* - * SAS hosts may queue > ATA_MAX_QUEUE commands so use - * unique per-device budget token as a tag. - */ - if (WARN_ON_ONCE(cmd->budget_token >= ATA_MAX_QUEUE)) - goto fail; - tag = cmd->budget_token; - } else { - tag = scsi_cmd_to_rq(cmd)->tag; - } + WARN_ON_ONCE(cmd->device->host->tag_set.nr_hw_queues > 1); + + /* SAS hosts may queue > ATA_MAX_QUEUE commands. */ + if (ap->flags & ATA_FLAG_SAS_HOST && WARN_ON_ONCE(tag >= ATA_MAX_QUEUE)) + goto fail; qc = __ata_qc_from_tag(ap, tag); qc->tag = qc->hw_tag = tag;