db1_printf(("Disk is no longer busy for this buffer... %d %ld %ld\n", unit, bp->b_resid, bp->b_bcount));
KernelWakeupFunc(vbp)	struct buf *vbp;{	RF_DiskQueueData_t *req = NULL;	RF_DiskQueue_t *queue;	struct raidbuf *raidbp = (struct raidbuf *) vbp;	struct buf *bp;	struct raid_softc *rs;	int     unit;	register int s;	s = splbio();		/* XXX */	db1_printf(("recovering the request queue:\n"));	req = raidbp->req;	bp = raidbp->rf_obp;#if 0	db1_printf(("bp=0x%x\n", bp));#endif	queue = (RF_DiskQueue_t *) req->queue;	if (raidbp->rf_buf.b_flags & B_ERROR) {#if 0		printf("Setting bp->b_flags!!! %d\n", raidbp->rf_buf.b_error);#endif		bp->b_flags |= B_ERROR;		bp->b_error = raidbp->rf_buf.b_error ?		    raidbp->rf_buf.b_error : EIO;	}#if 0	db1_printf(("raidbp->rf_buf.b_bcount=%d\n", (int) raidbp->rf_buf.b_bcount));	db1_printf(("raidbp->rf_buf.b_bufsize=%d\n", (int) raidbp->rf_buf.b_bufsize));	db1_printf(("raidbp->rf_buf.b_resid=%d\n", (int) raidbp->rf_buf.b_resid));	db1_printf(("raidbp->rf_buf.b_data=0x%x\n", raidbp->rf_buf.b_data));#endif	/* XXX methinks this could be wrong... */#if 1	bp->b_resid = raidbp->rf_buf.b_resid;#endif	if (req->tracerec) {		RF_ETIMER_STOP(req->tracerec->timer);		RF_ETIMER_EVAL(req->tracerec->timer);		RF_LOCK_MUTEX(rf_tracing_mutex);		req->tracerec->diskwait_us += RF_ETIMER_VAL_US(req->tracerec->timer);		req->tracerec->phys_io_us += RF_ETIMER_VAL_US(req->tracerec->timer);		req->tracerec->num_phys_ios++;		RF_UNLOCK_MUTEX(rf_tracing_mutex);	}	bp->b_bcount = raidbp->rf_buf.b_bcount;	/* XXXX ?? */	unit = queue->raidPtr->raidid;	/* *Much* simpler :-> */	/* XXX Ok, let's get aggressive... If B_ERROR is set, let's go	 * ballistic, and mark the component as hosed... */#if 1	if (bp->b_flags & B_ERROR) {		/* Mark the disk as dead */		/* but only mark it once... */		if (queue->raidPtr->Disks[queue->row][queue->col].status ==		    rf_ds_optimal) {			printf("raid%d: IO Error.  Marking %s as failed.\n",			    unit, queue->raidPtr->Disks[queue->row][queue->col].devname);			queue->raidPtr->Disks[queue->row][queue->col].status =			    rf_ds_failed;			queue->raidPtr->status[queue->row] = rf_rs_degraded;			queue->raidPtr->numFailures++;			/* XXX here we should bump the version number for each component, and write that data out */		} else {	/* Disk is already dead... */			/* printf("Disk already marked as dead!\n"); */		}	}#endif	rs = &raid_softc[unit];	RAIDPUTBUF(rs, raidbp);	if (bp->b_resid == 0) {		db1_printf(("Disk is no longer busy for this buffer... %d %ld %ld\n",			unit, bp->b_resid, bp->b_bcount));		/* XXX is this the right place for a disk_unbusy()??!??!?!? */		disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid));	} else {		db1_printf(("b_resid is still %ld\n", bp->b_resid));	}	rf_DiskIOComplete(queue, req, (bp->b_flags & B_ERROR) ? 1 : 0);	(req->CompleteFunc) (req->argument, (bp->b_flags & B_ERROR) ? 1 : 0);	/* printf("Exiting KernelWakeupFunc\n"); */	splx(s);		/* XXX */}