All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, alan@lxorguk.ukuu.org.uk, albertcc@tw.ibm.com,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH] libata: implement ata_eh_finish_qcs()
Date: Mon, 3 Apr 2006 12:40:58 +0900	[thread overview]
Message-ID: <11440356581856-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11440356574107-git-send-email-htejun@gmail.com>

Implement EH helper function ata_eh_finish_qcs().  This function is
called after all EH actions are complete and finishes all the failed
qcs.  Depending on error status, a qc may be retried or completed.
This function is also responsible for loading qc->tf with resulting TF
values.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/libata-core.c |    1 +
 drivers/scsi/libata-eh.c   |   45 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/libata.h     |    2 ++
 3 files changed, 48 insertions(+), 0 deletions(-)

82204946494cd4749cd83431dd141560f33969c6
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 62dabb1..f3ab396 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5283,3 +5283,4 @@ EXPORT_SYMBOL_GPL(ata_eh_determine_qc);
 EXPORT_SYMBOL_GPL(ata_eh_autopsy);
 EXPORT_SYMBOL_GPL(ata_eh_report);
 EXPORT_SYMBOL_GPL(ata_eh_revive);
+EXPORT_SYMBOL_GPL(ata_eh_finish_qcs);
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c
index 3fc3f0f..80d1282 100644
--- a/drivers/scsi/libata-eh.c
+++ b/drivers/scsi/libata-eh.c
@@ -1029,3 +1029,48 @@ int ata_eh_revive(struct ata_port *ap, u
 
 	return rc;
 }
+
+/**
+ *	ata_eh_finish_qcs - complete or retry commands
+ *	@ap: host port to finish qc's for
+ *	@qc: the failed qc (can be NULL)
+ *	@tf: taskfile register of the failed qc
+ *
+ *	Retry or complete failed qc's.
+ *
+ *	LOCKING:
+ *	None.
+ */
+void ata_eh_finish_qcs(struct ata_port *ap, struct ata_queued_cmd *qc,
+		       struct ata_taskfile *tf)
+{
+	struct ata_taskfile tmp_tf;
+
+	if (qc) {
+		/* prevent infinite retry loop */
+		if (!qc->err_mask && !(qc->flags & ATA_QCFLAG_SENSE_VALID)) {
+			printk(KERN_WARNING "ata%u: dev %u qc has no error "
+			       "flag set after EH, forcing AC_ERR_OTHER\n",
+			       ap->id, qc->dev->devno);
+			qc->err_mask |= AC_ERR_OTHER;
+		}
+
+		/* FIXME: qc->tf will be used by completion callbacks
+		 * to generate SCSI sense data.  This is to share
+		 * sense generation code with old-EH drivers.  Once EH
+		 * migration is complete, generate sense data in this
+		 * function, considering both err_mask and tf.
+		 */
+		tmp_tf = *tf;
+		tmp_tf.flags = qc->tf.flags;
+		tmp_tf.protocol = qc->tf.protocol;
+		tmp_tf.ctl = qc->tf.ctl;
+		qc->tf = tmp_tf;
+
+		if (qc->err_mask & AC_ERR_INVALID ||
+		    qc->flags & ATA_QCFLAG_SENSE_VALID)
+			ata_eh_qc_complete(qc);
+		else
+			ata_eh_qc_retry(qc);
+	}
+}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed28a1d..f3f53ad 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -696,6 +696,8 @@ extern void ata_eh_report(struct ata_por
 extern int ata_eh_revive(struct ata_port *ap, unsigned int action,
 			 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
 			 ata_postreset_fn_t postreset);
+extern void ata_eh_finish_qcs(struct ata_port *ap, struct ata_queued_cmd *qc,
+			      struct ata_taskfile *tf);
 
 
 static inline int
-- 
1.2.4



  parent reply	other threads:[~2006-04-03  3:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03  3:40 [PATCHSET] new EH implementation Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: add constants and flags to be used by EH Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement ata_ering Tejun Heo
2006-04-03  3:40 ` [PATCH] ata_piix: convert to new EH Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement EH utility functions Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: add per-dev ata_ering Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement EH methods for BMDMA controllers Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement ata_eh_determine_qc() Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement ata_eh_revive() Tejun Heo
2006-04-03  3:40 ` Tejun Heo [this message]
2006-04-03  3:40 ` [PATCH] libata: implement ata_eh_autopsy() Tejun Heo
2006-04-03  3:40 ` [PATCH] libata: implement ata_eh_report() Tejun Heo
2006-04-03  3:40 ` [PATCH] ahci: convert to new EH Tejun Heo
2006-04-03  3:40 ` [PATCH] sata_sil: " Tejun Heo
2006-04-03  3:43 ` [PATCHSET] new EH implementation Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11440356581856-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.