aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-10-25 05:22:44 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-29 06:15:25 -0400
commit4dbfa39b6c95eb9d0aedb5bd00bb552b91c31e3d (patch)
treeb3b92aa44fe651af464373d8a21a3da8897fa479 /drivers/ata/libata-core.c
parent2a397e82c7db18019e408f953dd58dc1963a328c (diff)
libata: relocate and fix post-command processing
Some commands need post-processing after successful completion. This was done in ata_scsi_qc_complete() till now but this has the following problems. * Post-command processing gets executed when qc is completed from EH. Some qc's are retried from EH with zero err_mask and thus triggers unnecessary/incorrect post-command processing. * Command post processing doesn't belong to SAT layer. * Link-wide revalidation was scheduled where device revalidation suffices. This patch moves post-command processing to success completion path of ata_qc_complete() which is travelled iff the command is going to be completed without passing through EH and updates post-command processing such that device-specific action is used. While at it, restructure code a bit for readability. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 081e3dfb64d4..5aedd1af06e6 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5594,6 +5594,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5594 * taken care of. 5594 * taken care of.
5595 */ 5595 */
5596 if (ap->ops->error_handler) { 5596 if (ap->ops->error_handler) {
5597 struct ata_device *dev = qc->dev;
5598 struct ata_eh_info *ehi = &dev->link->eh_info;
5599
5597 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); 5600 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN);
5598 5601
5599 if (unlikely(qc->err_mask)) 5602 if (unlikely(qc->err_mask))
@@ -5612,6 +5615,23 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5612 if (qc->flags & ATA_QCFLAG_RESULT_TF) 5615 if (qc->flags & ATA_QCFLAG_RESULT_TF)
5613 fill_result_tf(qc); 5616 fill_result_tf(qc);
5614 5617
5618 /* Some commands need post-processing after successful
5619 * completion.
5620 */
5621 switch (qc->tf.command) {
5622 case ATA_CMD_SET_FEATURES:
5623 if (qc->tf.feature != SETFEATURES_WC_ON &&
5624 qc->tf.feature != SETFEATURES_WC_OFF)
5625 break;
5626 /* fall through */
5627 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
5628 case ATA_CMD_SET_MULTI: /* multi_count changed */
5629 /* revalidate device */
5630 ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE;
5631 ata_port_schedule_eh(ap);
5632 break;
5633 }
5634
5615 __ata_qc_complete(qc); 5635 __ata_qc_complete(qc);
5616 } else { 5636 } else {
5617 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) 5637 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED)