From 13b8d09f5de0aaa3153bbccc98baf247387823dc Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 15 May 2007 12:29:22 +0200 Subject: libata: track spindown status and skip spindown_compat if possible Our assumption that most distros issue STANDBYNOW seems wrong. The upstream sysvinit and thus many distros including gentoo and opensuse don't take any action for libata disks on spindown. We can skip compat handling for these distros so that they don't need to update anything to take advantage of kernel-side shutdown. Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/ata/libata-scsi.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/ata/libata-scsi.c') diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 07b5a3d4ed21..b6a1de8fad5b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -967,6 +967,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) * for more info. */ if (ata_spindown_compat && + (qc->dev->flags & ATA_DFLAG_SPUNDOWN) && (system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF)) { static unsigned long warned = 0; @@ -1394,6 +1395,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) } } + /* XXX: track spindown state for spindown_compat */ + if (unlikely(qc->tf.command == ATA_CMD_STANDBY || + qc->tf.command == ATA_CMD_STANDBYNOW1)) + qc->dev->flags |= ATA_DFLAG_SPUNDOWN; + else if (likely(system_state != SYSTEM_HALT && + system_state != SYSTEM_POWER_OFF)) + qc->dev->flags &= ~ATA_DFLAG_SPUNDOWN; + if (need_sense && !ap->ops->error_handler) ata_dump_status(ap->print_id, &qc->result_tf); -- cgit v1.2.3