From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 16 14:10:42 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 0A7B81065670; Thu, 16 Sep 2010 14:10:42 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 764198FC15; Thu, 16 Sep 2010 14:10:41 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id o8GEAMuA029068; Thu, 16 Sep 2010 16:10:37 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id o8GEAM1n029066; Thu, 16 Sep 2010 16:10:22 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201009161410.o8GEAM1n029066@lurza.secnetix.de> To: tijl@coosemans.org (Tijl Coosemans) Date: Thu, 16 Sep 2010 16:10:22 +0200 (CEST) In-Reply-To: <201009161540.08029.tijl@coosemans.org> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.5 (lurza.secnetix.de [127.0.0.1]); Thu, 16 Sep 2010 16:10:37 +0200 (CEST) Cc: freebsd-hackers@freebsd.org, mav@freebsd.org, Alexander Best 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:42 -0000 Tijl Coosemans wrote: > On Thursday 16 September 2010 10:41:07 Oliver Fromme wrote: > > 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. Is it? When I intend to power-off, I use shutdown -p, not shutdown -h. Quite often (but not always) when I halt a machine, I'm going to reboot to multi-user, not power off. In that case I certainly wouldn't want to spin the drives down and have them spun up immediately afterwards. I don't think that wear&tear caused by that procedure is completely insignificant (although it's certainly less of a problem than emergency unloads). For that reason I definitely want to have a way to disable the spindown function manually. > 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. Right, good point. I didn't notice because the shutdown function in ad(4) doesn't get the howto flag, so I assumed (without checking) that ada(4) doesn't get it either. > There's no need to make this more complicated with a sysctl > that can override this in my opinion. I'm afraid I have to disagree (see above). Apart from that, there's nothing complicated at all about a sysctl. > Also command2 should be command1 in this line: > > + if (cgd->ident_data.support.command2 & ATA_SUPPORT_POWERMGT) Oops ... You're right. Thanks for pointing that out. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind." -- Alan Kay, OOPSLA '97