Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 2010 15:40:01 +0200
From:      Tijl Coosemans <tijl@coosemans.org>
To:        freebsd-hackers@freebsd.org
Cc:        Alexander Best <arundel@freebsd.org>, mav@freebsd.org, Oliver Fromme <olli@lurza.secnetix.de>
Subject:   Re: Summary: Re: Spin down HDD after disk sync or before power off
Message-ID:  <201009161540.08029.tijl@coosemans.org>
In-Reply-To: <201009160841.o8G8f7Q2047725@lurza.secnetix.de>
References:  <201009160841.o8G8f7Q2047725@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart10116848.qj6mstj0Su
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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=3D0
>>
>> 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).
>=20
> 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)) !=3D 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)

--nextPart10116848.qj6mstj0Su
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iF4EABEIAAYFAkySHjcACgkQfoCS2CCgtispsgD+LN0j62if3uUa43YFwYM0CeQv
NPOutTmV6xb7ynDC3JsA/2abG7cabPUjYNCbXzQWwjjvOwSM3eDDS9aq/RA9R0Ov
=tIod
-----END PGP SIGNATURE-----

--nextPart10116848.qj6mstj0Su--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009161540.08029.tijl>