Commit 03faab78 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata: implement ATA_QCFLAG_RETRY

Currently whether a command should be retried after failure is
determined inside ata_eh_finish().  Add ATA_QCFLAG_RETRY and move the
logic into ata_eh_autopsy().  This makes things clearer and helps
extending retry determination logic.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent a5987e0a
...@@ -1785,6 +1785,11 @@ static void ata_eh_link_autopsy(struct ata_link *link) ...@@ -1785,6 +1785,11 @@ static void ata_eh_link_autopsy(struct ata_link *link)
if (qc->flags & ATA_QCFLAG_SENSE_VALID) if (qc->flags & ATA_QCFLAG_SENSE_VALID)
qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
/* determine whether the command is worth retrying */
if (!(qc->err_mask & AC_ERR_INVALID) &&
((qc->flags & ATA_QCFLAG_IO) || qc->err_mask != AC_ERR_DEV))
qc->flags |= ATA_QCFLAG_RETRY;
/* accumulate error info */ /* accumulate error info */
ehc->i.dev = qc->dev; ehc->i.dev = qc->dev;
all_err_mask |= qc->err_mask; all_err_mask |= qc->err_mask;
...@@ -2783,18 +2788,11 @@ void ata_eh_finish(struct ata_port *ap) ...@@ -2783,18 +2788,11 @@ void ata_eh_finish(struct ata_port *ap)
/* FIXME: Once EH migration is complete, /* FIXME: Once EH migration is complete,
* generate sense data in this function, * generate sense data in this function,
* considering both err_mask and tf. * considering both err_mask and tf.
*
* There's no point in retrying invalid
* (detected by libata) and non-IO device
* errors (rejected by device). Finish them
* immediately.
*/ */
if ((qc->err_mask & AC_ERR_INVALID) || if (qc->flags & ATA_QCFLAG_RETRY)
(!(qc->flags & ATA_QCFLAG_IO) &&
qc->err_mask == AC_ERR_DEV))
ata_eh_qc_complete(qc);
else
ata_eh_qc_retry(qc); ata_eh_qc_retry(qc);
else
ata_eh_qc_complete(qc);
} else { } else {
if (qc->flags & ATA_QCFLAG_SENSE_VALID) { if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
ata_eh_qc_complete(qc); ata_eh_qc_complete(qc);
......
...@@ -224,6 +224,7 @@ enum { ...@@ -224,6 +224,7 @@ enum {
ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */ ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */
ATA_QCFLAG_RETRY = (1 << 7), /* retry after failure */
ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment