From 28361c403683c2b00d4f5e76045f3ccd299bf99d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 11 May 2018 12:51:09 -0600 Subject: libata: add extra internal command Bump the internal tag to 32, instead of stealing the last tag in our regular command space. This works just fine, since we don't actually need a separate hardware tag for this. Internal commands cannot coexist with NCQ commands. As a bonus, we get rid of the special casing of what tag to use for the internal command. This is in preparation for utilizing all 32 commands for normal IO. Signed-off-by: Jens Axboe Signed-off-by: Tejun Heo --- drivers/ata/libata-core.c | 22 ++++++---------------- drivers/ata/libata-eh.c | 3 ++- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'drivers/ata') diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8fd352d4c190..5e2f679322cc 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1570,7 +1570,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, u8 command = tf->command; int auto_timeout = 0; struct ata_queued_cmd *qc; - unsigned int tag, preempted_tag; + unsigned int preempted_tag; u32 preempted_sactive; u64 preempted_qc_active; int preempted_nr_active_links; @@ -1588,20 +1588,10 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, } /* initialize internal qc */ + qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL); - /* XXX: Tag 0 is used for drivers with legacy EH as some - * drivers choke if any other tag is given. This breaks - * ata_tag_internal() test for those drivers. Don't use new - * EH stuff without converting to it. - */ - if (ap->ops->error_handler) - tag = ATA_TAG_INTERNAL; - else - tag = 0; - - qc = __ata_qc_from_tag(ap, tag); - - qc->tag = qc->hw_tag = tag; + qc->tag = ATA_TAG_INTERNAL; + qc->hw_tag = 0; qc->scsicmd = NULL; qc->ap = ap; qc->dev = dev; @@ -5156,7 +5146,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) qc->flags = 0; tag = qc->tag; - if (likely(ata_tag_valid(tag))) { + if (ata_tag_valid(tag)) { qc->tag = ATA_TAG_POISON; if (ap->flags & ATA_FLAG_SAS_HOST) ata_sas_free_tag(tag, ap); @@ -5415,7 +5405,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) WARN_ON_ONCE(link->sactive); ap->nr_active_links++; - link->active_tag = qc->hw_tag; + link->active_tag = qc->tag; } qc->flags |= ATA_QCFLAG_ACTIVE; diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 9f9aad77fbcd..eadbe26ba3dc 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -1057,7 +1057,8 @@ static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link) /* we're gonna abort all commands, no need for fast drain */ ata_eh_set_pending(ap, 0); - for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { + /* include internal tag in iteration */ + for (tag = 0; tag <= ATA_MAX_QUEUE; tag++) { struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); if (qc && (!link || qc->dev->link == link)) { -- cgit v1.2.3