libata: implement ATA_DFLAG_DUBIOUS_XFER
ATA_DFLAG_DUBIOUS_XFER is set whenever data transfer speed or method changes and gets cleared when data transfer command succeeds in the newly configured transfer mode. This will be used to improve speed down logic. Signed-off-by: Tejun Heo <htejun@gmail.com< Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
@@ -5797,6 +5797,22 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
|
||||
ap->ops->tf_read(ap, &qc->result_tf);
|
||||
}
|
||||
|
||||
static void ata_verify_xfer(struct ata_queued_cmd *qc)
|
||||
{
|
||||
struct ata_device *dev = qc->dev;
|
||||
|
||||
if (ata_tag_internal(qc->tag))
|
||||
return;
|
||||
|
||||
if (ata_is_nodata(qc->tf.protocol))
|
||||
return;
|
||||
|
||||
if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol))
|
||||
return;
|
||||
|
||||
dev->flags &= ~ATA_DFLAG_DUBIOUS_XFER;
|
||||
}
|
||||
|
||||
/**
|
||||
* ata_qc_complete - Complete an active ATA command
|
||||
* @qc: Command to complete
|
||||
@@ -5868,6 +5884,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
|
||||
break;
|
||||
}
|
||||
|
||||
if (unlikely(dev->flags & ATA_DFLAG_DUBIOUS_XFER))
|
||||
ata_verify_xfer(qc);
|
||||
|
||||
__ata_qc_complete(qc);
|
||||
} else {
|
||||
if (qc->flags & ATA_QCFLAG_EH_SCHEDULED)
|
||||
|
Reference in New Issue
Block a user