On Thursday 16 September 2010 10:41:07 Oliver Fromme wrote: > Alexander Best wrote: >> On Wed Sep 15 10, Oliver Fromme wrote: >>> The patch below will work with the new CAM ATA driver >>> (i.e. ada(4) disks). It adds a sysctl, so you can switch >>> the spin-down off if you're going to just reboot: >>> # sysctl kern.cam.ada.spindown_shutdown=0 >> >> the hdd should spindown when a shutdown has been issued and not spindown, >> if a reboot has been issued. > > Right. That's why my shutdown wrapper script sets the sysctl > to 0 when the -r option is present (I've got that wrapper > script for ages, for different reasons). > > Also, there are cases where it is completely impossible to > decide automatically whether the disks should be spun down > or not. For example, if the admin issues a shutdown -h > (halt), there's no way for the OS to know in advance whether > the admin is going to switch the machine off or reboot to > multi-user. So there must be a way for the user to forcibly > enable/disable the spindown feature. I think a sysctl is > the most appropriate way to do that, isn't it?
I would just spin down the disk in case of a halt. An unwanted spin down is harmless compared to an emergency shutdown and usually the intention is to power off rather than reboot. Part of your patch modifies ada_shutdown. That function already gets the reboot(2) howto flags passed to it, so you could test for (howto & (RB_HALT | RB_POWEROFF)) != 0 before issuing the STANDBY command. There's no need to make this more complicated with a sysctl that can override this in my opinion. Also command2 should be command1 in this line: + if (cgd->ident_data.support.command2 & ATA_SUPPORT_POWERMGT)
signature.asc
Description: This is a digitally signed message part.