summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum/vinuminterrupt.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-03-20 10:44:49 +0000
committerphk <phk@FreeBSD.org>2000-03-20 10:44:49 +0000
commita246e10f55686681d4b6bd4dba5ca661b4e34bb0 (patch)
tree13a3ded179bf1de0aff7c33b0eba0534aa2dcf09 /sys/dev/vinum/vinuminterrupt.c
parentf274a82c1448c090620cb35f8516831602a12658 (diff)
downloadFreeBSD-src-a246e10f55686681d4b6bd4dba5ca661b4e34bb0.zip
FreeBSD-src-a246e10f55686681d4b6bd4dba5ca661b4e34bb0.tar.gz
Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set. B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes. Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL. Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading. This change is a step in the direction towards a stackable BIO capability. A lot of this patch were machine generated (Thanks to style(9) compliance!) Vinum users: Greg has not had time to test this yet, be careful.
Diffstat (limited to 'sys/dev/vinum/vinuminterrupt.c')
-rw-r--r--sys/dev/vinum/vinuminterrupt.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/dev/vinum/vinuminterrupt.c b/sys/dev/vinum/vinuminterrupt.c
index 935317a..8a23462 100644
--- a/sys/dev/vinum/vinuminterrupt.c
+++ b/sys/dev/vinum/vinuminterrupt.c
@@ -89,7 +89,7 @@ complete_rqe(struct buf *bp)
else if (rq->error == 0) /* no: do we have one already? */
rq->error = EIO; /* no: catchall "I/O error" */
SD[rqe->sdno].lasterror = rq->error;
- if (bp->b_flags & B_READ) {
+ if (bp->b_iocmd == BIO_READ) {
log(LOG_ERR, "%s: fatal read I/O error\n", SD[rqe->sdno].name);
set_sd_state(rqe->sdno, sd_crashed, setstate_force); /* subdisk is crashed */
} else { /* write operation */
@@ -105,7 +105,7 @@ complete_rqe(struct buf *bp)
}
}
/* Now update the statistics */
- if (bp->b_flags & B_READ) { /* read operation */
+ if (bp->b_iocmd == BIO_READ) { /* read operation */
DRIVE[rqe->driveno].reads++;
DRIVE[rqe->driveno].bytes_read += bp->b_bcount;
SD[rqe->sdno].reads++;
@@ -226,7 +226,7 @@ sdio_done(struct buf *bp)
#endif
sbp->bp->b_resid = sbp->b.b_resid; /* copy the resid field */
/* Now update the statistics */
- if (bp->b_flags & B_READ) { /* read operation */
+ if (bp->b_iocmd == BIO_READ) { /* read operation */
DRIVE[sbp->driveno].reads++;
DRIVE[sbp->driveno].bytes_read += sbp->b.b_bcount;
SD[sbp->sdno].reads++;
@@ -340,11 +340,10 @@ complete_raid5_write(struct rqelement *rqe)
} else
panic("complete_raid5_write: malloc conflict");
- if ((rqe->b.b_flags & B_READ) /* this was a read */
+ if ((rqe->b.b_iocmd == BIO_READ) /* this was a read */
&&((rqe->flags & XFR_BAD_SUBDISK) == 0)) { /* and we can write this block */
- rqe->b.b_flags &= ~(B_READ | B_DONE); /* we're writing now */
- rqe->b.b_flags |= B_CALL; /* call us when you're done */
- rqe->b.b_iodone = complete_rqe; /* by calling us here */
+ rqe->b.b_flags &= ~B_DONE; /* we're writing now */
+ rqe->b.b_iodone = complete_rqe; /* call us here when done */
rqe->flags &= ~XFR_PARITYOP; /* reset flags that brought us here */
rqe->b.b_data = &bp->b_data[rqe->useroffset << DEV_BSHIFT]; /* point to the user data */
rqe->b.b_bcount = rqe->datalen << DEV_BSHIFT; /* length to write */
@@ -365,7 +364,7 @@ complete_raid5_write(struct rqelement *rqe)
if (debug & DEBUG_ADDRESSES)
log(LOG_DEBUG,
" %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n",
- rqe->b.b_flags & B_READ ? "Read" : "Write",
+ rqe->b.b_iocmd == BIO_READ ? "Read" : "Write",
major(rqe->b.b_dev),
minor(rqe->b.b_dev),
rqe->sdno,
@@ -382,9 +381,8 @@ complete_raid5_write(struct rqelement *rqe)
}
/* Finally, write the parity block */
rqe = &rqg->rqe[0];
- rqe->b.b_flags &= ~(B_READ | B_DONE); /* we're writing now */
- rqe->b.b_flags |= B_CALL; /* call us when you're done */
- rqe->b.b_iodone = complete_rqe; /* by calling us here */
+ rqe->b.b_flags &= ~B_DONE; /* we're writing now */
+ rqe->b.b_iodone = complete_rqe; /* call us here when done */
rqg->flags &= ~XFR_PARITYOP; /* reset flags that brought us here */
rqe->b.b_bcount = rqe->buflen << DEV_BSHIFT; /* length to write */
rqe->b.b_bufsize = rqe->b.b_bcount; /* don't claim we have more */
@@ -404,7 +402,7 @@ complete_raid5_write(struct rqelement *rqe)
if (debug & DEBUG_ADDRESSES)
log(LOG_DEBUG,
" %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n",
- rqe->b.b_flags & B_READ ? "Read" : "Write",
+ rqe->b.b_iocmd == BIO_READ ? "Read" : "Write",
major(rqe->b.b_dev),
minor(rqe->b.b_dev),
rqe->sdno,
OpenPOWER on IntegriCloud