From: Tejun Heo <htejun@gmail.com>
To: Daniel Drake <dsd@gentoo.org>, Jeff Garzik <jeff@garzik.org>,
IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH] libata: track spindown status and skip spindown_compat if possible
Date: Tue, 15 May 2007 12:29:22 +0200 [thread overview]
Message-ID: <46498B82.1030802@gmail.com> (raw)
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 <htejun@gmail.com>
---
This patch is generated on top of fix-shutdown-warning-message-printing.
http://article.gmane.org/gmane.linux.ide/18823
Jeff, I think we can avoid a lot of problems with this. Those distros
which didn't do anything on shutdown would still cause emergency
unload on older kernels but at least it isn't a regression and things
should just work on newer kernels.
If you ack this, I'll update the shutdown.html page accordingly.
Thanks.
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_
* 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
}
}
+ /* 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 27d9362..a52734b 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),
next reply other threads:[~2007-05-15 10:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-15 10:29 Tejun Heo [this message]
2007-05-15 11:53 ` [PATCH] libata: track spindown status and skip spindown_compat if possible Francesco Pretto
2007-05-15 12:03 ` Tejun Heo
2007-05-15 12:12 ` Stephen Clark
2007-05-15 12:17 ` Tejun Heo
2007-05-15 16:44 ` Francesco Pretto
2007-05-16 5:22 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46498B82.1030802@gmail.com \
--to=htejun@gmail.com \
--cc=dsd@gentoo.org \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).