Home | History | Annotate | Line # | Download | only in ata
ld_ataraid.c revision 1.10
      1  1.10  hannken /*	$NetBSD: ld_ataraid.c,v 1.10 2004/01/25 18:06:48 hannken Exp $	*/
      2   1.1  thorpej 
      3   1.1  thorpej /*
      4   1.1  thorpej  * Copyright (c) 2003 Wasabi Systems, Inc.
      5   1.1  thorpej  * All rights reserved.
      6   1.1  thorpej  *
      7   1.1  thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8   1.1  thorpej  *
      9   1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     10   1.1  thorpej  * modification, are permitted provided that the following conditions
     11   1.1  thorpej  * are met:
     12   1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     13   1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     14   1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     16   1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     17   1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     18   1.1  thorpej  *    must display the following acknowledgement:
     19   1.1  thorpej  *	This product includes software developed for the NetBSD Project by
     20   1.1  thorpej  *	Wasabi Systems, Inc.
     21   1.1  thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22   1.1  thorpej  *    or promote products derived from this software without specific prior
     23   1.1  thorpej  *    written permission.
     24   1.1  thorpej  *
     25   1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26   1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27   1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28   1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29   1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30   1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31   1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32   1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33   1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34   1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35   1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36   1.1  thorpej  */
     37   1.1  thorpej 
     38   1.1  thorpej /*
     39   1.1  thorpej  * Support for ATA RAID logical disks.
     40   1.1  thorpej  *
     41   1.1  thorpej  * Note that all the RAID happens in software here; the ATA RAID
     42   1.1  thorpej  * controllers we're dealing with (Promise, etc.) only support
     43   1.1  thorpej  * configuration data on the component disks, with the BIOS supporting
     44   1.1  thorpej  * booting from the RAID volumes.
     45   1.1  thorpej  */
     46   1.8    lukem 
     47   1.8    lukem #include <sys/cdefs.h>
     48  1.10  hannken __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.10 2004/01/25 18:06:48 hannken Exp $");
     49   1.1  thorpej 
     50   1.1  thorpej #include "rnd.h"
     51   1.1  thorpej 
     52   1.1  thorpej #include <sys/param.h>
     53   1.1  thorpej #include <sys/systm.h>
     54   1.1  thorpej #include <sys/conf.h>
     55   1.1  thorpej #include <sys/kernel.h>
     56   1.1  thorpej #include <sys/device.h>
     57   1.1  thorpej #include <sys/buf.h>
     58   1.1  thorpej #include <sys/dkio.h>
     59   1.1  thorpej #include <sys/disk.h>
     60   1.1  thorpej #include <sys/disklabel.h>
     61   1.1  thorpej #include <sys/fcntl.h>
     62   1.1  thorpej #include <sys/malloc.h>
     63   1.1  thorpej #include <sys/vnode.h>
     64   1.1  thorpej #if NRND > 0
     65   1.1  thorpej #include <sys/rnd.h>
     66   1.1  thorpej #endif
     67   1.1  thorpej 
     68   1.1  thorpej #include <miscfs/specfs/specdev.h>
     69   1.1  thorpej 
     70   1.1  thorpej #include <dev/ldvar.h>
     71   1.1  thorpej 
     72   1.1  thorpej #include <dev/ata/ata_raidvar.h>
     73   1.1  thorpej 
     74   1.1  thorpej struct ld_ataraid_softc {
     75   1.1  thorpej 	struct ld_softc sc_ld;
     76   1.1  thorpej 
     77   1.1  thorpej 	struct ataraid_array_info *sc_aai;
     78   1.1  thorpej 	struct vnode *sc_vnodes[ATA_RAID_MAX_DISKS];
     79   1.1  thorpej 
     80   1.1  thorpej 	void	(*sc_iodone)(struct buf *);
     81   1.1  thorpej };
     82   1.1  thorpej 
     83   1.1  thorpej static int	ld_ataraid_match(struct device *, struct cfdata *, void *);
     84   1.1  thorpej static void	ld_ataraid_attach(struct device *, struct device *, void *);
     85   1.1  thorpej 
     86   1.1  thorpej static int	ld_ataraid_dump(struct ld_softc *, void *, int, int);
     87   1.1  thorpej 
     88   1.1  thorpej static int	ld_ataraid_start_span(struct ld_softc *, struct buf *);
     89   1.1  thorpej 
     90   1.1  thorpej static int	ld_ataraid_start_raid0(struct ld_softc *, struct buf *);
     91   1.1  thorpej static void	ld_ataraid_iodone_raid0(struct buf *);
     92   1.1  thorpej 
     93   1.1  thorpej CFATTACH_DECL(ld_ataraid, sizeof(struct ld_ataraid_softc),
     94   1.1  thorpej     ld_ataraid_match, ld_ataraid_attach, NULL, NULL);
     95   1.1  thorpej 
     96   1.1  thorpej static int ld_ataraid_initialized;
     97   1.1  thorpej static struct pool ld_ataraid_cbufpl;
     98   1.1  thorpej 
     99   1.1  thorpej struct cbuf {
    100   1.1  thorpej 	struct buf	cb_buf;		/* new I/O buf */
    101   1.1  thorpej 	struct buf	*cb_obp;	/* ptr. to original I/O buf */
    102   1.1  thorpej 	struct ld_ataraid_softc *cb_sc;	/* pointer to ld softc */
    103   1.1  thorpej 	u_int		cb_comp;	/* target component */
    104   1.1  thorpej 	SIMPLEQ_ENTRY(cbuf) cb_q;	/* fifo of component buffers */
    105   1.1  thorpej };
    106   1.1  thorpej 
    107   1.1  thorpej #define	CBUF_GET()	pool_get(&ld_ataraid_cbufpl, PR_NOWAIT);
    108   1.1  thorpej #define	CBUF_PUT(cbp)	pool_put(&ld_ataraid_cbufpl, (cbp))
    109   1.1  thorpej 
    110   1.1  thorpej static int
    111   1.1  thorpej ld_ataraid_match(struct device *parent, struct cfdata *match, void *aux)
    112   1.1  thorpej {
    113   1.1  thorpej 
    114   1.1  thorpej 	return (1);
    115   1.1  thorpej }
    116   1.1  thorpej 
    117   1.1  thorpej static void
    118   1.1  thorpej ld_ataraid_attach(struct device *parent, struct device *self, void *aux)
    119   1.1  thorpej {
    120   1.1  thorpej 	struct ld_ataraid_softc *sc = (void *) self;
    121   1.1  thorpej 	struct ld_softc *ld = &sc->sc_ld;
    122   1.1  thorpej 	struct ataraid_array_info *aai = aux;
    123   1.1  thorpej 	const char *level;
    124   1.1  thorpej 	struct vnode *vp;
    125   1.1  thorpej 	char unklev[32];
    126   1.1  thorpej 	u_int i;
    127   1.1  thorpej 
    128   1.1  thorpej 	if (ld_ataraid_initialized == 0) {
    129   1.1  thorpej 		ld_ataraid_initialized = 1;
    130   1.1  thorpej 		pool_init(&ld_ataraid_cbufpl, sizeof(struct cbuf), 0,
    131   1.1  thorpej 		    0, 0, "ldcbuf", NULL);
    132   1.1  thorpej 	}
    133   1.1  thorpej 
    134   1.1  thorpej 	sc->sc_aai = aai;	/* this data persists */
    135   1.1  thorpej 
    136   1.1  thorpej 	ld->sc_maxxfer = MAXPHYS * aai->aai_width;	/* XXX */
    137   1.1  thorpej 	ld->sc_secperunit = aai->aai_capacity;
    138   1.1  thorpej 	ld->sc_secsize = 512;				/* XXX */
    139   1.1  thorpej 	ld->sc_maxqueuecnt = 128;			/* XXX */
    140   1.1  thorpej 	ld->sc_dump = ld_ataraid_dump;
    141   1.1  thorpej 
    142   1.1  thorpej 	switch (aai->aai_level) {
    143   1.1  thorpej 	case AAI_L_SPAN:
    144   1.1  thorpej 		level = "SPAN";
    145   1.1  thorpej 		ld->sc_start = ld_ataraid_start_span;
    146   1.1  thorpej 		sc->sc_iodone = ld_ataraid_iodone_raid0;
    147   1.1  thorpej 		break;
    148   1.1  thorpej 
    149   1.1  thorpej 	case AAI_L_RAID0:
    150   1.9  thorpej 		level = "RAID-0";
    151   1.1  thorpej 		ld->sc_start = ld_ataraid_start_raid0;
    152   1.1  thorpej 		sc->sc_iodone = ld_ataraid_iodone_raid0;
    153   1.1  thorpej 		break;
    154   1.1  thorpej 
    155   1.1  thorpej 	case AAI_L_RAID1:
    156   1.9  thorpej 		level = "RAID-1";
    157   1.1  thorpej 		break;
    158   1.1  thorpej 
    159   1.1  thorpej 	case AAI_L_RAID0 | AAI_L_RAID1:
    160   1.9  thorpej 		level = "RAID-10";
    161   1.1  thorpej 		break;
    162   1.1  thorpej 
    163   1.1  thorpej 	default:
    164   1.1  thorpej 		sprintf(unklev, "<unknown level 0x%x>", aai->aai_level);
    165   1.1  thorpej 		level = unklev;
    166   1.1  thorpej 	}
    167   1.1  thorpej 
    168   1.1  thorpej 	aprint_naive(": ATA %s array\n", level);
    169   1.1  thorpej 	aprint_normal(": %s ATA %s array\n",
    170   1.1  thorpej 	    ata_raid_type_name(aai->aai_type), level);
    171   1.1  thorpej 
    172   1.1  thorpej 	if (ld->sc_start == NULL) {
    173   1.1  thorpej 		aprint_error("%s: unsupported array type\n",
    174   1.1  thorpej 		    ld->sc_dv.dv_xname);
    175   1.1  thorpej 		return;
    176   1.1  thorpej 	}
    177   1.1  thorpej 
    178   1.1  thorpej 	/*
    179   1.1  thorpej 	 * We get a geometry from the device; use it.
    180   1.1  thorpej 	 */
    181   1.1  thorpej 	ld->sc_nheads = aai->aai_heads;
    182   1.1  thorpej 	ld->sc_nsectors = aai->aai_sectors;
    183   1.1  thorpej 	ld->sc_ncylinders = aai->aai_cylinders;
    184   1.1  thorpej 
    185   1.1  thorpej 	/*
    186   1.1  thorpej 	 * Configure all the component disks.
    187   1.1  thorpej 	 */
    188   1.1  thorpej 	for (i = 0; i < aai->aai_ndisks; i++) {
    189   1.1  thorpej 		struct ataraid_disk_info *adi = &aai->aai_disks[i];
    190   1.1  thorpej 		int bmajor, error;
    191   1.1  thorpej 		dev_t dev;
    192   1.1  thorpej 
    193   1.1  thorpej 		bmajor = devsw_name2blk(adi->adi_dev->dv_xname, NULL, 0);
    194   1.1  thorpej 		dev = MAKEDISKDEV(bmajor, adi->adi_dev->dv_unit, RAW_PART);
    195   1.1  thorpej 		error = bdevvp(dev, &vp);
    196   1.1  thorpej 		if (error)
    197   1.3  thorpej 			break;
    198   1.1  thorpej 		error = VOP_OPEN(vp, FREAD|FWRITE, NOCRED, 0);
    199   1.1  thorpej 		if (error) {
    200   1.1  thorpej 			vput(vp);
    201   1.1  thorpej 			/*
    202   1.1  thorpej 			 * XXX This is bogus.  We should just mark the
    203   1.1  thorpej 			 * XXX component as FAILED, and write-back new
    204   1.1  thorpej 			 * XXX config blocks.
    205   1.1  thorpej 			 */
    206   1.3  thorpej 			break;
    207   1.1  thorpej 		}
    208   1.1  thorpej 
    209   1.1  thorpej 		VOP_UNLOCK(vp, 0);
    210   1.1  thorpej 		sc->sc_vnodes[i] = vp;
    211   1.1  thorpej 	}
    212   1.3  thorpej 	if (i == aai->aai_ndisks) {
    213   1.3  thorpej 		ld->sc_flags = LDF_ENABLED;
    214   1.3  thorpej 		goto finish;
    215   1.3  thorpej 	}
    216   1.1  thorpej 
    217   1.1  thorpej 	for (i = 0; i < aai->aai_ndisks; i++) {
    218   1.1  thorpej 		vp = sc->sc_vnodes[i];
    219   1.1  thorpej 		sc->sc_vnodes[i] = NULL;
    220   1.3  thorpej 		if (vp != NULL)
    221   1.7     fvdl 			(void) vn_close(vp, FREAD|FWRITE, NOCRED, curproc);
    222   1.1  thorpej 	}
    223   1.3  thorpej 
    224   1.3  thorpej  finish:
    225   1.3  thorpej 	ldattach(ld);
    226   1.1  thorpej }
    227   1.1  thorpej 
    228   1.1  thorpej static struct cbuf *
    229   1.1  thorpej ld_ataraid_make_cbuf(struct ld_ataraid_softc *sc, struct buf *bp,
    230   1.1  thorpej     u_int comp, daddr_t bn, caddr_t addr, long bcount)
    231   1.1  thorpej {
    232   1.1  thorpej 	struct cbuf *cbp;
    233   1.1  thorpej 
    234   1.1  thorpej 	cbp = CBUF_GET();
    235   1.1  thorpej 	if (cbp == NULL)
    236   1.1  thorpej 		return (NULL);
    237   1.4  thorpej 	BUF_INIT(&cbp->cb_buf);
    238   1.1  thorpej 	cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
    239   1.1  thorpej 	cbp->cb_buf.b_iodone = sc->sc_iodone;
    240   1.1  thorpej 	cbp->cb_buf.b_proc = bp->b_proc;
    241   1.1  thorpej 	cbp->cb_buf.b_vp = sc->sc_vnodes[comp];
    242   1.1  thorpej 	cbp->cb_buf.b_blkno = bn + sc->sc_aai->aai_offset;
    243   1.1  thorpej 	cbp->cb_buf.b_data = addr;
    244   1.1  thorpej 	cbp->cb_buf.b_bcount = bcount;
    245   1.1  thorpej 
    246   1.1  thorpej 	/* Context for iodone */
    247   1.1  thorpej 	cbp->cb_obp = bp;
    248   1.1  thorpej 	cbp->cb_sc = sc;
    249   1.1  thorpej 	cbp->cb_comp = comp;
    250   1.1  thorpej 
    251   1.1  thorpej 	return (cbp);
    252   1.1  thorpej }
    253   1.1  thorpej 
    254   1.1  thorpej static int
    255   1.1  thorpej ld_ataraid_start_span(struct ld_softc *ld, struct buf *bp)
    256   1.1  thorpej {
    257   1.1  thorpej 	struct ld_ataraid_softc *sc = (void *) ld;
    258   1.1  thorpej 	struct ataraid_array_info *aai = sc->sc_aai;
    259   1.1  thorpej 	struct ataraid_disk_info *adi;
    260   1.1  thorpej 	SIMPLEQ_HEAD(, cbuf) cbufq;
    261   1.1  thorpej 	struct cbuf *cbp;
    262   1.1  thorpej 	caddr_t addr;
    263   1.1  thorpej 	daddr_t bn;
    264   1.1  thorpej 	long bcount, rcount;
    265   1.1  thorpej 	u_int comp;
    266   1.1  thorpej 
    267   1.1  thorpej 	/* Allocate component buffers. */
    268   1.1  thorpej 	SIMPLEQ_INIT(&cbufq);
    269   1.1  thorpej 	addr = bp->b_data;
    270   1.1  thorpej 
    271   1.1  thorpej 	/* Find the first component. */
    272   1.1  thorpej 	comp = 0;
    273   1.1  thorpej 	adi = &aai->aai_disks[comp];
    274   1.1  thorpej 	bn = bp->b_rawblkno;
    275   1.1  thorpej 	while (bn >= adi->adi_compsize) {
    276   1.1  thorpej 		bn -= adi->adi_compsize;
    277   1.1  thorpej 		adi = &aai->aai_disks[++comp];
    278   1.1  thorpej 	}
    279   1.1  thorpej 
    280   1.1  thorpej 	bp->b_resid = bp->b_bcount;
    281   1.1  thorpej 
    282   1.1  thorpej 	for (bcount = bp->b_bcount; bcount > 0; bcount -= rcount) {
    283   1.1  thorpej 		rcount = bp->b_bcount;
    284   1.1  thorpej 		if ((adi->adi_compsize - bn) < btodb(rcount))
    285   1.1  thorpej 			rcount = dbtob(adi->adi_compsize - bn);
    286   1.1  thorpej 
    287   1.1  thorpej 		cbp = ld_ataraid_make_cbuf(sc, bp, comp, bn, addr, rcount);
    288   1.1  thorpej 		if (cbp == NULL) {
    289   1.1  thorpej 			/* Free the already allocated component buffers. */
    290   1.1  thorpej 			while ((cbp = SIMPLEQ_FIRST(&cbufq)) != NULL) {
    291   1.1  thorpej 				SIMPLEQ_REMOVE_HEAD(&cbufq, cb_q);
    292   1.1  thorpej 				CBUF_PUT(cbp);
    293   1.1  thorpej 			}
    294   1.5  thorpej 			return (EAGAIN);
    295   1.1  thorpej 		}
    296   1.1  thorpej 
    297   1.1  thorpej 		/*
    298   1.1  thorpej 		 * For a span, we always know we advance to the next disk,
    299   1.1  thorpej 		 * and always start at offset 0 on that disk.
    300   1.1  thorpej 		 */
    301   1.1  thorpej 		adi = &aai->aai_disks[++comp];
    302   1.1  thorpej 		bn = 0;
    303   1.1  thorpej 
    304   1.1  thorpej 		SIMPLEQ_INSERT_TAIL(&cbufq, cbp, cb_q);
    305   1.1  thorpej 		addr += rcount;
    306   1.1  thorpej 	}
    307   1.1  thorpej 
    308   1.1  thorpej 	/* Now fire off the requests. */
    309   1.1  thorpej 	while ((cbp = SIMPLEQ_FIRST(&cbufq)) != NULL) {
    310   1.1  thorpej 		SIMPLEQ_REMOVE_HEAD(&cbufq, cb_q);
    311   1.1  thorpej 		if ((cbp->cb_buf.b_flags & B_READ) == 0)
    312   1.1  thorpej 			cbp->cb_buf.b_vp->v_numoutput++;
    313  1.10  hannken 		VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf);
    314   1.1  thorpej 	}
    315   1.1  thorpej 
    316   1.1  thorpej 	return (0);
    317   1.1  thorpej }
    318   1.1  thorpej 
    319   1.1  thorpej static int
    320   1.1  thorpej ld_ataraid_start_raid0(struct ld_softc *ld, struct buf *bp)
    321   1.1  thorpej {
    322   1.1  thorpej 	struct ld_ataraid_softc *sc = (void *) ld;
    323   1.1  thorpej 	struct ataraid_array_info *aai = sc->sc_aai;
    324   1.1  thorpej 	SIMPLEQ_HEAD(, cbuf) cbufq;
    325   1.1  thorpej 	struct cbuf *cbp;
    326   1.1  thorpej 	caddr_t addr;
    327   1.1  thorpej 	daddr_t bn, cbn, tbn, off;
    328   1.1  thorpej 	long bcount, rcount;
    329   1.1  thorpej 	u_int comp;
    330   1.1  thorpej 
    331   1.1  thorpej 	/* Allocate component buffers. */
    332   1.1  thorpej 	SIMPLEQ_INIT(&cbufq);
    333   1.1  thorpej 	addr = bp->b_data;
    334   1.1  thorpej 	bn = bp->b_rawblkno;
    335   1.1  thorpej 
    336   1.1  thorpej 	bp->b_resid = bp->b_bcount;
    337   1.1  thorpej 
    338   1.1  thorpej 	for (bcount = bp->b_bcount; bcount > 0; bcount -= rcount) {
    339   1.1  thorpej 		tbn = bn / aai->aai_interleave;
    340   1.1  thorpej 		off = bn % aai->aai_interleave;
    341   1.1  thorpej 
    342   1.1  thorpej 		if (__predict_false(tbn == aai->aai_capacity /
    343   1.1  thorpej 					   aai->aai_interleave)) {
    344   1.1  thorpej 			/* Last stripe. */
    345   1.1  thorpej 			daddr_t sz = (aai->aai_capacity -
    346   1.1  thorpej 				      (tbn * aai->aai_interleave)) /
    347   1.1  thorpej 				     aai->aai_width;
    348   1.1  thorpej 			comp = off / sz;
    349   1.1  thorpej 			cbn = ((tbn / aai->aai_width) * aai->aai_interleave) +
    350   1.1  thorpej 			    (off % sz);
    351   1.1  thorpej 			rcount = min(bcount, dbtob(sz));
    352   1.1  thorpej 		} else {
    353   1.1  thorpej 			comp = tbn % aai->aai_width;
    354   1.1  thorpej 			cbn = ((tbn / aai->aai_width) * aai->aai_interleave) +
    355   1.1  thorpej 			    off;
    356   1.1  thorpej 			rcount = min(bcount, dbtob(aai->aai_interleave - off));
    357   1.1  thorpej 		}
    358   1.1  thorpej 
    359   1.1  thorpej 		cbp = ld_ataraid_make_cbuf(sc, bp, comp, cbn, addr, rcount);
    360   1.1  thorpej 		if (cbp == NULL) {
    361   1.1  thorpej 			/* Free the already allocated component buffers. */
    362   1.1  thorpej 			while ((cbp = SIMPLEQ_FIRST(&cbufq)) != NULL) {
    363   1.1  thorpej 				SIMPLEQ_REMOVE_HEAD(&cbufq, cb_q);
    364   1.1  thorpej 				CBUF_PUT(cbp);
    365   1.1  thorpej 			}
    366   1.5  thorpej 			return (EAGAIN);
    367   1.1  thorpej 		}
    368   1.1  thorpej 		SIMPLEQ_INSERT_TAIL(&cbufq, cbp, cb_q);
    369   1.1  thorpej 		bn += btodb(rcount);
    370   1.1  thorpej 		addr += rcount;
    371   1.1  thorpej 	}
    372   1.1  thorpej 
    373   1.1  thorpej 	/* Now fire off the requests. */
    374   1.1  thorpej 	while ((cbp = SIMPLEQ_FIRST(&cbufq)) != NULL) {
    375   1.1  thorpej 		SIMPLEQ_REMOVE_HEAD(&cbufq, cb_q);
    376   1.1  thorpej 		if ((cbp->cb_buf.b_flags & B_READ) == 0)
    377   1.1  thorpej 			cbp->cb_buf.b_vp->v_numoutput++;
    378  1.10  hannken 		VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf);
    379   1.1  thorpej 	}
    380   1.1  thorpej 
    381   1.1  thorpej 	return (0);
    382   1.1  thorpej }
    383   1.1  thorpej 
    384   1.1  thorpej /*
    385   1.1  thorpej  * Called at interrupt time.  Mark the component as done and if all
    386   1.1  thorpej  * components are done, take an "interrupt".
    387   1.1  thorpej  */
    388   1.1  thorpej static void
    389   1.1  thorpej ld_ataraid_iodone_raid0(struct buf *vbp)
    390   1.1  thorpej {
    391   1.1  thorpej 	struct cbuf *cbp = (struct cbuf *) vbp;
    392   1.1  thorpej 	struct buf *bp = cbp->cb_obp;
    393   1.1  thorpej 	struct ld_ataraid_softc *sc = cbp->cb_sc;
    394   1.1  thorpej 	long count;
    395   1.1  thorpej 	int s;
    396   1.1  thorpej 
    397   1.1  thorpej 	s = splbio();
    398   1.1  thorpej 
    399   1.1  thorpej 	if (cbp->cb_buf.b_flags & B_ERROR) {
    400   1.1  thorpej 		bp->b_flags |= B_ERROR;
    401   1.1  thorpej 		bp->b_error = cbp->cb_buf.b_error ?
    402   1.1  thorpej 		    cbp->cb_buf.b_error : EIO;
    403   1.1  thorpej 
    404   1.1  thorpej 		/* XXX Update component config blocks. */
    405   1.1  thorpej 
    406   1.1  thorpej 		printf("%s: error %d on component %d\n",
    407   1.1  thorpej 		    sc->sc_ld.sc_dv.dv_xname, bp->b_error, cbp->cb_comp);
    408   1.1  thorpej 	}
    409   1.1  thorpej 	count = cbp->cb_buf.b_bcount;
    410   1.1  thorpej 	CBUF_PUT(cbp);
    411   1.1  thorpej 
    412   1.1  thorpej 	/* If all done, "interrupt". */
    413   1.1  thorpej 	bp->b_resid -= count;
    414   1.1  thorpej 	if (bp->b_resid < 0)
    415   1.1  thorpej 		panic("ld_ataraid_iodone_raid0: count");
    416   1.1  thorpej 	if (bp->b_resid == 0)
    417   1.1  thorpej 		lddone(&sc->sc_ld, bp);
    418   1.1  thorpej 	splx(s);
    419   1.1  thorpej }
    420   1.1  thorpej 
    421   1.1  thorpej static int
    422   1.1  thorpej ld_ataraid_dump(struct ld_softc *sc, void *data, int blkno, int blkcnt)
    423   1.1  thorpej {
    424   1.1  thorpej 
    425   1.1  thorpej 	return (EIO);
    426   1.1  thorpej }
    427