Date: Fri, 6 Mar 2009 07:40:11 -0600 From: Octavian Covalschi <octavian.covalschi@gmail.com> To: Daniel Thiele <dthiele@gmx.net> Cc: freebsd-hackers@freebsd.org Subject: Re: Spin down HDD after disk sync or before power off Message-ID: <c0f49ea0903060540k5b170218j19a271f892128e10@mail.gmail.com> In-Reply-To: <49B04B19.5010100@gmx.net> References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <49AF1C1B.3050604@gmx.net> <c0f49ea0903041706i5c3b9f3ex123ea84fd0b17442@mail.gmail.com> <49AF2CCA.2080706@gmx.net> <c0f49ea0903041800k38acddabra2d42475a00051ef@mail.gmail.com> <c0f49ea0903041811i7d52c16dy9b29b54e070701e7@mail.gmail.com> <c0f49ea0903042200u1b181b0u494c64d8873fc339@mail.gmail.com> <49B04563.3010002@gmx.net> <c0f49ea0903051343g19cb3be9n2d8ef31431b6cd7a@mail.gmail.com> <49B04B19.5010100@gmx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
I played more with this, and got here so far: if (atadev->param.support.command1 & ATA_SUPPORT_STANDBY) { device_printf(dev, "Trying to spindown before poweroff.\n"); atadev->spindown = 1; ad_spindown((void *)dev); } else { device_printf(dev, "Cannot spindown before poweroff.\n"); } for some reason this check works on my laptop: if (atadev->param.support.command1 & ATA_SUPPORT_STANDBY) instead of if (atadev->param.support.command2 & ATA_SUPPORT_STANDBY) command1 vs command2 I'm using 7.1-STABLE... By the way, does anyone know why ad_shutdown is _not_ called at poweroff? Apparently it's called only at halt & reboot... Still looking... PS: I think last post didn't get to entire mail list, so trying to send it again. On Thu, Mar 5, 2009 at 3:58 PM, Daniel Thiele <dthiele@gmx.net> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Octavian Covalschi wrote: > | I tried your patch 1st, but it didn't work for me for shutdown, although > I > | didn't try it with halt (I assumed they work the same). > | > | While I was looking into that, I've discovered "ad_spindown" function, > and > | tried to use it, and as I said, it works (for me at least), but only with > | halt. > | > > Hmm, here is what David Tolpin mentioned back in 2006 when he replied > (privately) to the fist fix I came up with: > > "Besides, I had to increase timeout in ata-queue for controlcmd " > > I am no kernel expert, so I am not quite sure how to incorporate his > suggestion, but may be this helps with your problem. > > I would be interested in your progress on this topic, for maybe some day > one of my machines will refuse to spin down the disk with the "simple" > patch, too. > > | > | On Thu, Mar 5, 2009 at 3:34 PM, Daniel Thiele <dthiele@gmx.net> wrote: > | > | Octavian Covalschi wrote: > | | OK. > | | > | | After several _kernel_ recompilations (by the end I found out that I > | can use > | | -DNO_KERNELCLEAN ) I've got some results. > | | > | | As i found out that ata-disk.c already has ad_spindown function, witch > I > | | tried to use, so after small changes I have: > | | > | | static void > | | ad_shutdown(device_t dev) > | | { > | | struct ata_device *atadev = device_get_softc(dev); > | | > | | if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) > | | ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); > | | > | | /* start */ > | | device_printf(dev, "Forced spindown\n"); > | | atadev->spindown = 1; > | | ad_spindown((void *)dev); > | | /* end */ > | | } > | | > | | But for some reason this works only with Halt or shutdown -h now, on > | | shutdown -p it even doesn't get inside ad_shutdown. > | | Well at least I have this :) > | | > | > | Does putting > | > | if (atadev->param.support.command2 & > (ATA_SUPPORT_APM|ATA_SUPPORT_STANDBY)) > | ~ ata_controlcmd(dev, ATA_STANDBY_IMMEDIATE, 0, 0, 0); > | > | directly into ad_shutdown() work? > | > | About your gmirror question: Unfortunately I never used gmirror together > | with the spindown-hack, but I (as a just layperson on this topic(!)) do > | not see any reason why this could cause a problem, since ad_shutdown() > | is most likely called after the disks got unmounted and after GEOM is > | done with them. > | > | Best regards, > | > | Daniel > |> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.11 (FreeBSD) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkmwSxUACgkQCOZKcWNoXg5QBQCcDADmK8RrIduZCAY6IksuHSNm > disAnRUjx6SgGUPghw+/X9uf5oFFdEs/ > =xmQO > -----END PGP SIGNATURE----- >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c0f49ea0903060540k5b170218j19a271f892128e10>