[ltp] [PATCH] 2.6.18: Unload disks heads before powering down

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Mon, 2 Oct 2006 13:29:09 -0300


On Sun, 01 Oct 2006, Shem Multinymous wrote:
> On 9/29/06, Henrique de Moraes Holschuh <hmh@hmh.eng.br> wrote:
> >Log suspend/shutdown activity
> >
> >Tell the user when we spin down disks on suspend, and when flush > caches 
> >on
> >shutdown.  This is useful to track down issues with bandaid > stuff in
> >userspace halt(8), and also double-suspends on suspend-to-disk.
> 
> There's another code path: userspace (e.g., "hdparm -y") may issue a
> STANDBY (IMMEDIATE) via an ioctl on the device.

Yes. I am working on how to use the equivalent of hdparm -C to not issue
cache flushes and standby transitions without reason.  Actually, just not
issuing them at all should do the job (as a transition to Sleep or Standby
should *also* flush caches, and should not wake a non-spinning drive), but I
find it likely some schmuck screwed this up in some disk firmware out there. 

Note that hdparm -C doesn't work because of a libata passthrough IOCTL bug,
a patch is floating in LKML, and it certianly works just fine from kernel
space.  Probably, the passthrough also needs some domain validation added to
track SLEEP commands and mark the drive as offline in that case (hdparm -Y),
so that the kernel knows what to do if it does need to talk to the disk.

But implementing it ain't trivial for me, as I don't really know what I am
doing ;-)  (as in I need to understand libata more to avoid screwing up too
badly).  The rest of the patch was straightforward, but implementing
ata_check_power_mode ain't that simple.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh