Subject: Re: port bio(4) and bioctl(8) from openbsd ?
To: None <tech-kern@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 04/07/2007 19:51:37
On Sat, Apr 07, 2007 at 07:07:19PM +0200, Manuel Bouyer wrote:
> Hi,
> do we want to port the bio(4) interface and associated bioctl(8) tool
> from openbsd ? Basically it allows control of hardware RAID controllers in a
> generic way (get states, add hot-spare, start rebuilds, etc ...).
> On OpenBSD it's currently supported on ami(4), arc(4), ciss(4), mfi(4).
> I won't go into the softraid stuff, at last not yet.
> Man pages:
> http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sbin/bioctl/bioctl.8?rev=1.43&content-type=text/plain
> http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/share/man/man4/bio.4?rev=1.19&content-type=text/plain
> 
> In kernel, there's a pseudo-device (bio) to which RAID controllers registers
> (note that we can use the controllers without bio(4) in the kernel).
> This pseudo-device keeps a list of raid controllers, and dispatch the
> IOCTLs. This avoids having one major device per controller driver type.
> 
> OpenBSD has added sensors for the drives: SENSOR_DRIVE, with the states:
> #define SENSOR_DRIVE_EMPTY    1
> #define SENSOR_DRIVE_READY    2
> #define SENSOR_DRIVE_POWERUP  3
> #define SENSOR_DRIVE_ONLINE   4
> #define SENSOR_DRIVE_IDLE     5
> #define SENSOR_DRIVE_ACTIVE   6
> #define SENSOR_DRIVE_REBUILD  7
> #define SENSOR_DRIVE_POWERDOWN        8
> #define SENSOR_DRIVE_FAIL     9
> #define SENSOR_DRIVE_PFAIL    10
> The benefit of this is that we could get notification in real time
> instead of polling though bioctl.
> 
> I want this for mfi(4), for which I have no alternatives to get RAID status
> (if a drive fail you don't know, unless you go in front of the box and look
> at the LEDs). I will also add support to amr(4) as I have the hardware
> for this.

The sensor part could also be usefull for some SATA controllers, which
can report mechanical switch state for hot-plug drives.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--