Spin down HDD after disk sync or before power off
wblock at wonkity.com
Sat Jan 30 01:29:19 UTC 2010
On Fri, 29 Jan 2010, Jung-uk Kim wrote:
> On Friday 29 January 2010 05:38 pm, Warren Block wrote:
> I am not 100% sure but I think it should be something like the
> attached patch.
Yes, I had the two commands backwards. So let me try to summarize:
ad_shutdown uses ATA_FLUSHCACHE writes out any cached data, but does not
park the heads. At powerdown, the heads do an emergency park, which is
louder than a normal park and possibly damaging.
Adding ATA_STANDBY_IMMEDIATE after the ATA_FLUSHCACHE will park the
heads more quietly and possibly more safely. Should do no harm, at
ad_spindown looks like it's meant to spin the disk down for sleep
operations, and does some higher-level things.
I suspect flushcache and standby should be as close together as possible
to avoid the chance of anything getting back into the cache or spinning
the disk back up.
Anyway, testing this use of ad_spindown inside ad_shutdown brought back
the GLINK on shutdown.
A fixed version of the earlier patch that does flushcache and then
standbyimmediate is attached.
-Warren Block * Rapid City, South Dakota USA
-------------- next part --------------
--- sys/dev/ata/ata-disk.c.orig 2010-01-29 18:15:49.000000000 -0700
+++ sys/dev/ata/ata-disk.c 2010-01-29 18:16:47.000000000 -0700
@@ -193,7 +193,10 @@
if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
- return 0;
+ if (atadev->param.support.command2 & ATA_SUPPORT_POWERMGT)
+ ata_controlcmd(dev, ATA_STANDBY_IMMEDIATE, 0, 0, 0);
+ return 0;
More information about the freebsd-hackers