Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Feb 2010 08:28:39 -0500
From:      Andrew Duane <aduane@juniper.net>
To:        Warren Block <wblock@wonkity.com>, Erich Dollansky <erich@alogreentechnologies.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   RE: Spin down HDD after disk sync or before power off
Message-ID:  <AC6674AB7BC78549BB231821ABF7A9AE90006546B4@EMBX01-WF.jnpr.net>
In-Reply-To: <alpine.BSF.2.00.1002031946340.11182@wonkity.com>
References:  <201002031343.o13Dhj7i052507@lurza.secnetix.de> <alpine.BSF.2.00.1002031328060.9787@wonkity.com> <201002041009.05222.erich@alogreentechnologies.com>, <alpine.BSF.2.00.1002031946340.11182@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help

________________________________________
From: owner-freebsd-hackers@freebsd.org [owner-freebsd-hackers@freebsd.org]=
 On Behalf Of Warren Block [wblock@wonkity.com]
Sent: Wednesday, February 03, 2010 7:43 PM
To: Erich Dollansky
Cc: freebsd-hackers@freebsd.org
Subject: Re: Spin down HDD after disk sync or before power off

On Thu, 4 Feb 2010, Erich Dollansky wrote:
> In case of a reboot, it is already known when the command is given that t=
he machine will restart without being powered of.
>
> If you spin-down the disk, you lose one start cycle.
>
> It is not that important but if it can be done with just one if, please, =
just do it.

AFAICT ad_shutdown can't tell whether it's called for a reboot or a
poweroff, it's just told to "shut down".  So maybe it's one if, but it's
somewhere above ata-disk.c but below reboot(RB_POWEROFF).

-Warren Block * Rapid City, South Dakota USA
________________________________________

You can register for a shutdown even that *does* get to know the "howto" va=
riable; we do this quite a bit on some of our platforms that need special h=
andling at power-off versus halt.

    extern void jsrxnle_poweroff_devices(void *junk, int howto);

    /* Registering power-off handler to be called at the system shutdown */
    EVENTHANDLER_REGISTER(shutdown_final, jsrxnle_poweroff_devices, NULL, S=
HUTDOWN_PRI_LAST + 10);

The howto argument can be checked for RB_POWEROFF:

    if (howto & RB_POWEROFF) {
           /* Spin Down */
    }

--
Andrew Duane             Juniper Networks
978-589-0551              10 Technology Park Dr
aduane@juniper.net      Westford, MA  01886-3418




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