Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2001 19:41:20 -0800
From:      Scott Renfro <scott@renfro.org>
To:        Soren Schmidt <sos@freebsd.dk>
Cc:        freebsd-hackers@freebsd.org, Richard Johnson <raj@cisco.com>
Subject:   ata-disk ioctl and atactl patch
Message-ID:  <20010225194120.A64003@bonsai.home.renfro.org>

next in thread | raw e-mail | index | archive | help
As I promised on -mobile earlier this week, I've cleaned up my patches
to port the {Net,Open}BSD atactl utility, including a simplistic
ata-disk ioctl.  They apply cleanly against this afternoon's -stable
(including Soren's latest commit bringing -stable up to date with
-current).  I've been running them for some time and they ''work great
here''.

Before announcing this in a broader context, I wanted to get a bit of
feedback on the ioctl implementation.  In particular, is it safe to
just do an ata_command inside adioctl() without any further checking?
(e.g., can this cause bad things to happen under heavy i/o load?)

Here's a snippet from the newly added adioctl() in ata-disk.c:

    switch (cmd) {
    case ATAIOCCOMMAND:
    {
        struct atareq *req = (struct atareq *)addr;
        if (!req)
            return EINVAL;       /* request not valid */
        
        /* issue an ata command */
        switch (req->command) {
        case ATAPI_STANDBY_IMMEDIATE:
        case ATAPI_IDLE_IMMEDIATE:
            /* no count argument */
            error = ata_command(adp->controller, adp->unit, req->command,
                                0, 0, 0, 0, 0, ATA_WAIT_INTR);

The full diffs are at http://www.renfro.org/scott (at the bottom of
the page).  These patches only implement the idle, setidle, standby,
and setstandby commands.  I haven't tackled sleep, identify, or
checkpower commands.  (Sleep isn't hard to implement, but I haven't
tested whether the driver would actually reset all state properly when
coming out of sleep or whether more code is required to do this).

For those that question the usefulness of atactl: I do find this
extremely useful.  On a laptop with noatime mounts, softupdates, and
syslog, cron, and atrun disabled, I can go a long time (an hour or
more) without the drive spinning up.  It also cuts the noise level of
my Z505L in half.  (Now if I can just get the fan to shut up ;-)

Thanks,
-scott

-- 
Scott Renfro <scott@renfro.org>                          +1 650 906 9618

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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