aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ccd
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2000-03-20 10:44:49 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2000-03-20 10:44:49 +0000
commit21144e3bf1f416a758f6546bfabfa8e4e8cba507 (patch)
treec87da548b12fd12c48f1e5c89d087ddfa088ee78 /sys/dev/ccd
parent44bdcfa638d9ca31180090798a88116220f7f625 (diff)
downloadsrc-21144e3bf1f416a758f6546bfabfa8e4e8cba507.tar.gz
src-21144e3bf1f416a758f6546bfabfa8e4e8cba507.zip
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.
Notes
Notes: svn path=/head/; revision=58345
Diffstat (limited to 'sys/dev/ccd')
-rw-r--r--sys/dev/ccd/ccd.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c
index 672ffe2fbef1..fe45b6edc046 100644
--- a/sys/dev/ccd/ccd.c
+++ b/sys/dev/ccd/ccd.c
@@ -193,7 +193,7 @@ static void ccdattach __P((void));
static int ccd_modevent __P((module_t, int, void *));
/* called by biodone() at interrupt time */
-static void ccdiodone __P((struct ccdbuf *cbp));
+static void ccdiodone __P((struct buf *bp));
static void ccdstart __P((struct ccd_softc *, struct buf *));
static void ccdinterleave __P((struct ccd_softc *, int));
@@ -887,7 +887,7 @@ ccdstart(cs, bp)
* to writes when making this determination and we
* also try to avoid hogging.
*/
- if ((cbp[0]->cb_buf.b_flags & B_READ) == 0) {
+ if (cbp[0]->cb_buf.b_iocmd == BIO_WRITE) {
cbp[0]->cb_buf.b_vp->v_numoutput++;
cbp[1]->cb_buf.b_vp->v_numoutput++;
VOP_STRATEGY(cbp[0]->cb_buf.b_vp,
@@ -911,7 +911,7 @@ ccdstart(cs, bp)
/*
* Not mirroring
*/
- if ((cbp[0]->cb_buf.b_flags & B_READ) == 0)
+ if (cbp[0]->cb_buf.b_iocmd == BIO_WRITE)
cbp[0]->cb_buf.b_vp->v_numoutput++;
VOP_STRATEGY(cbp[0]->cb_buf.b_vp, &cbp[0]->cb_buf);
}
@@ -1050,8 +1050,9 @@ ccdbuffer(cb, cs, bp, bn, addr, bcount)
* Fill in the component buf structure.
*/
cbp = getccdbuf(NULL);
- cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
- cbp->cb_buf.b_iodone = (void (*)(struct buf *))ccdiodone;
+ cbp->cb_buf.b_flags = bp->b_flags;
+ cbp->cb_buf.b_iocmd = bp->b_iocmd;
+ cbp->cb_buf.b_iodone = ccdiodone;
cbp->cb_buf.b_dev = ci->ci_dev; /* XXX */
cbp->cb_buf.b_blkno = cbn + cboff + CCD_OFFSET;
cbp->cb_buf.b_offset = dbtob(cbn + cboff + CCD_OFFSET);
@@ -1122,9 +1123,10 @@ ccdintr(cs, bp)
* take a ccd interrupt.
*/
static void
-ccdiodone(cbp)
- struct ccdbuf *cbp;
+ccdiodone(ibp)
+ struct buf *ibp;
{
+ struct ccdbuf *cbp = (struct ccdbuf *)ibp;
struct buf *bp = cbp->cb_obp;
int unit = cbp->cb_unit;
int count, s;
@@ -1153,7 +1155,7 @@ ccdiodone(cbp)
const char *msg = "";
if ((ccd_softc[unit].sc_cflags & CCDF_MIRROR) &&
- (cbp->cb_buf.b_flags & B_READ) &&
+ (cbp->cb_buf.b_iocmd == BIO_READ) &&
(cbp->cb_pflags & CCDPF_MIRROR_DONE) == 0) {
/*
* We will try our read on the other disk down
@@ -1186,7 +1188,7 @@ ccdiodone(cbp)
*/
if (ccd_softc[unit].sc_cflags & CCDF_MIRROR) {
- if ((cbp->cb_buf.b_flags & B_READ) == 0) {
+ if (cbp->cb_buf.b_iocmd == BIO_WRITE) {
/*
* When writing, handshake with the second buffer
* to determine when both are done. If both are not