From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 16 14:10:00 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 148871065672; Thu, 16 Sep 2010 14:10:00 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay001.isp.belgacom.be (mailrelay001.isp.belgacom.be [195.238.6.51]) by mx1.freebsd.org (Postfix) with ESMTP id 7B5728FC08; Thu, 16 Sep 2010 14:09:59 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj4FAIe7kUxbsVM9/2dsb2JhbACUMY1icsFXhUEE Received: from 61.83-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.83.61]) by relay.skynet.be with ESMTP; 16 Sep 2010 15:40:09 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.4/8.14.4) with ESMTP id o8GDe8sH004587; Thu, 16 Sep 2010 15:40:08 +0200 (CEST) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: freebsd-hackers@freebsd.org Date: Thu, 16 Sep 2010 15:40:01 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-PRERELEASE; KDE/4.4.5; i386; ; ) References: <201009160841.o8G8f7Q2047725@lurza.secnetix.de> In-Reply-To: <201009160841.o8G8f7Q2047725@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart10116848.qj6mstj0Su"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201009161540.08029.tijl@coosemans.org> Cc: Alexander Best , mav@freebsd.org, Oliver Fromme Subject: Re: Summary: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2010 14:10:00 -0000 --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--