Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=13b8d09f5de0aaa3153bbccc98baf247387823dc
Commit:     13b8d09f5de0aaa3153bbccc98baf247387823dc
Parent:     da071b42f73dabbd0daf7ea4c3ff157d53b00648
Author:     Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Tue May 15 12:29:22 2007 +0200
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed May 16 01:18:31 2007 -0400

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-scsi.c |    9 +++++++++
 include/linux/libata.h    |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 07b5a3d..b6a1de8 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);
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9b2122d..666592e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -140,6 +140,7 @@ enum {
 
        ATA_DFLAG_PIO           = (1 << 8), /* device limited to PIO mode */
        ATA_DFLAG_NCQ_OFF       = (1 << 9), /* device limited to non-NCQ mode */
+       ATA_DFLAG_SPUNDOWN      = (1 << 10), /* XXX: for spindown_compat */
        ATA_DFLAG_INIT_MASK     = (1 << 16) - 1,
 
        ATA_DFLAG_DETACH        = (1 << 16),
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to