summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/vinum')
-rw-r--r--sys/dev/vinum/vinumdaemon.c2
-rw-r--r--sys/dev/vinum/vinumext.h4
-rw-r--r--sys/dev/vinum/vinuminterrupt.c22
-rw-r--r--sys/dev/vinum/vinumio.c5
-rw-r--r--sys/dev/vinum/vinumraid5.c8
-rw-r--r--sys/dev/vinum/vinumrequest.c26
-rw-r--r--sys/dev/vinum/vinumrevive.c16
-rw-r--r--sys/dev/vinum/vinumstate.c2
8 files changed, 43 insertions, 42 deletions
diff --git a/sys/dev/vinum/vinumdaemon.c b/sys/dev/vinum/vinumdaemon.c
index 835fec8..3ac54d2 100644
--- a/sys/dev/vinum/vinumdaemon.c
+++ b/sys/dev/vinum/vinumdaemon.c
@@ -106,7 +106,7 @@ vinum_daemon(void)
log(LOG_WARNING,
"vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%x, length %ld\n",
rq,
- rq->bp->b_flags & B_READ ? "Read" : "Write",
+ rq->bp->b_iocmd == BIO_READ ? "Read" : "Write",
major(rq->bp->b_dev),
minor(rq->bp->b_dev),
rq->bp->b_blkno,
diff --git a/sys/dev/vinum/vinumext.h b/sys/dev/vinum/vinumext.h
index 5d87ad4..6518b90 100644
--- a/sys/dev/vinum/vinumext.h
+++ b/sys/dev/vinum/vinumext.h
@@ -46,8 +46,8 @@ extern int debug; /* debug flags */
#endif
/* Physical read and write drive */
-#define read_drive(a, b, c, d) driveio (a, b, c, d, B_READ)
-#define write_drive(a, b, c, d) driveio (a, b, c, d, B_WRITE)
+#define read_drive(a, b, c, d) driveio (a, b, c, d, BIO_READ)
+#define write_drive(a, b, c, d) driveio (a, b, c, d, BIO_WRITE)
#define CHECKALLOC(ptr, msg) \
if (ptr == NULL) \
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,
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index 17fc5fe..8913d66 100644
--- a/sys/dev/vinum/vinumio.c
+++ b/sys/dev/vinum/vinumio.c
@@ -297,7 +297,8 @@ driveio(struct drive *drive, char *buf, size_t length, off_t offset, int flag)
int len = min(length, MAXBSIZE); /* maximum block device transfer is MAXBSIZE */
bp = geteblk(len); /* get a buffer header */
- bp->b_flags = flag;
+ bp->b_flags = 0;
+ bp->b_iocmd = flag;
bp->b_dev = drive->dev; /* device */
bp->b_blkno = offset / drive->partinfo.disklab->d_secsize; /* block number */
bp->b_saveaddr = bp->b_data;
@@ -754,7 +755,7 @@ write_volume_label(int volno)
dlp = (struct disklabel *) bp->b_data;
*dlp = *lp;
bp->b_flags &= ~B_INVAL;
- bp->b_flags |= B_WRITE;
+ bp->b_iocmd = BIO_WRITE;
/*
* This should read:
diff --git a/sys/dev/vinum/vinumraid5.c b/sys/dev/vinum/vinumraid5.c
index 2c44d71..5596814 100644
--- a/sys/dev/vinum/vinumraid5.c
+++ b/sys/dev/vinum/vinumraid5.c
@@ -360,7 +360,7 @@ bre5(struct request *rq,
}
if (SD[plex->sdnos[m.psdno]].state < sd_reborn) /* is our parity subdisk down? */
m.badsdno = m.psdno; /* note that it's down */
- if (bp->b_flags & B_READ) { /* read operation */
+ if (bp->b_iocmd == BIO_READ) { /* read operation */
for (mysdno = m.firstsdno; rsectors > 0; mysdno++) {
if (mysdno == m.psdno) /* ignore parity on read */
mysdno++;
@@ -493,7 +493,7 @@ bre5(struct request *rq,
rqe->driveno = sd->driveno;
if (build_rq_buffer(rqe, plex)) /* build the buffer */
return REQUEST_ENOMEM; /* can't do it */
- rqe->b.b_flags |= B_READ; /* we must read first */
+ rqe->b.b_iocmd == BIO_READ; /* we must read first */
m.sdcount++; /* adjust the subdisk count */
rqno++; /* and point to the next request */
}
@@ -534,7 +534,7 @@ bre5(struct request *rq,
return REQUEST_ENOMEM; /* can't do it */
if ((m.flags & XFR_PARITYOP) /* parity operation, */
&&((m.flags & XFR_BAD_SUBDISK) == 0)) /* and not the bad subdisk, */
- rqe->b.b_flags |= B_READ; /* we must read first */
+ rqe->b.b_iocmd = BIO_READ; /* we must read first */
/* Now update pointers for the next block */
*diskaddr += m.datalen; /* skip past what we've done */
@@ -577,7 +577,7 @@ bre5(struct request *rq,
rqe->driveno = sd->driveno;
if (build_rq_buffer(rqe, plex)) /* build the buffer */
return REQUEST_ENOMEM; /* can't do it */
- rqe->b.b_flags |= B_READ; /* we must read first */
+ rqe->b.b_iocmd = BIO_READ; /* we must read first */
}
}
/*
diff --git a/sys/dev/vinum/vinumrequest.c b/sys/dev/vinum/vinumrequest.c
index da7bff4..98c7892 100644
--- a/sys/dev/vinum/vinumrequest.c
+++ b/sys/dev/vinum/vinumrequest.c
@@ -224,7 +224,7 @@ vinumstart(struct buf *bp, int reviveok)
maxplex = 1; /* just the one plex */
}
- if (bp->b_flags & B_READ) {
+ if (bp->b_iocmd == BIO_READ) {
/*
* This is a read request. Decide
* which plex to read from.
@@ -337,7 +337,7 @@ launch_requests(struct request *rq, int reviveok)
"Revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%x, length %ld\n",
rq->sdno,
rq,
- rq->bp->b_flags & B_READ ? "Read" : "Write",
+ rq->bp->b_iocmd == BIO_READ ? "Read" : "Write",
major(rq->bp->b_dev),
minor(rq->bp->b_dev),
rq->bp->b_blkno,
@@ -351,7 +351,7 @@ launch_requests(struct request *rq, int reviveok)
log(LOG_DEBUG,
"Request: %p\n%s dev %d.%d, offset 0x%x, length %ld\n",
rq,
- rq->bp->b_flags & B_READ ? "Read" : "Write",
+ rq->bp->b_iocmd == BIO_READ ? "Read" : "Write",
major(rq->bp->b_dev),
minor(rq->bp->b_dev),
rq->bp->b_blkno,
@@ -406,7 +406,7 @@ launch_requests(struct request *rq, int reviveok)
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,
@@ -505,7 +505,7 @@ bre(struct request *rq,
s = checksdstate(sd, rq, *diskaddr, diskend); /* do we need to change state? */
if (s == REQUEST_DOWN) { /* down? */
rqe->flags = XFR_BAD_SUBDISK; /* yup */
- if (rq->bp->b_flags & B_READ) /* read request, */
+ if (rq->bp->b_iocmd == BIO_READ) /* read request, */
return REQUEST_DEGRADED; /* give up here */
/*
* If we're writing, don't give up
@@ -589,7 +589,7 @@ bre(struct request *rq,
s = checksdstate(sd, rq, *diskaddr, diskend); /* do we need to change state? */
if (s == REQUEST_DOWN) { /* down? */
rqe->flags = XFR_BAD_SUBDISK; /* yup */
- if (rq->bp->b_flags & B_READ) /* read request, */
+ if (rq->bp->b_iocmd == BIO_READ) /* read request, */
return REQUEST_DEGRADED; /* give up here */
/*
* If we're writing, don't give up
@@ -791,8 +791,8 @@ build_rq_buffer(struct rqelement *rqe, struct plex *plex)
/* Initialize the buf struct */
/* copy these flags from user bp */
- bp->b_flags = ubp->b_flags & (B_ORDERED | B_NOCACHE | B_READ | B_ASYNC);
- bp->b_flags |= B_CALL; /* inform us when it's done */
+ bp->b_flags = ubp->b_flags & (B_ORDERED | B_NOCACHE | B_ASYNC);
+ bp->b_iocmd = BIO_READ; /* inform us when it's done */
BUF_LOCKINIT(bp); /* get a lock for the buffer */
BUF_LOCK(bp, LK_EXCLUSIVE); /* and lock it */
@@ -891,9 +891,9 @@ sdio(struct buf *bp)
if (drive->state != drive_up) {
if (sd->state >= sd_crashed) {
- if (bp->b_flags & B_READ) /* reading, */
+ if (bp->b_iocmd == BIO_READ) /* reading, */
set_sd_state(sd->sdno, sd_crashed, setstate_force);
- else
+ else if (bp->b_iocmd == BIO_WRITE) /* writing, */
set_sd_state(sd->sdno, sd_stale, setstate_force);
}
bp->b_flags |= B_ERROR;
@@ -920,7 +920,7 @@ sdio(struct buf *bp)
return;
}
bzero(sbp, sizeof(struct sdbuf)); /* start with nothing */
- sbp->b.b_flags = bp->b_flags | B_CALL; /* inform us when it's done */
+ sbp->b.b_flags = bp->b_flags;
sbp->b.b_bufsize = bp->b_bufsize; /* buffer size */
sbp->b.b_bcount = bp->b_bcount; /* number of bytes to transfer */
sbp->b.b_resid = bp->b_resid; /* and amount waiting */
@@ -947,7 +947,7 @@ sdio(struct buf *bp)
if (debug & DEBUG_ADDRESSES)
log(LOG_DEBUG,
" %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n",
- sbp->b.b_flags & B_READ ? "Read" : "Write",
+ sbp->b.b_iocmd == BIO_READ ? "Read" : "Write",
major(sbp->b.b_dev),
minor(sbp->b.b_dev),
sbp->sdno,
@@ -992,7 +992,7 @@ vinum_bounds_check(struct buf *bp, struct volume *vol)
&& bp->b_blkno + size > LABELSECTOR /* and finishes after */
#endif
&& (!(vol->flags & VF_RAW)) /* and it's not raw */
- &&(bp->b_flags & B_READ) == 0 /* and it's a write */
+ && (bp->b_iocmd == BIO_WRITE) /* and it's a write */
&& (!vol->flags & (VF_WLABEL | VF_LABELLING))) { /* and we're not allowed to write the label */
bp->b_error = EROFS; /* read-only */
bp->b_flags |= B_ERROR;
diff --git a/sys/dev/vinum/vinumrevive.c b/sys/dev/vinum/vinumrevive.c
index bfa1c9a..3204512 100644
--- a/sys/dev/vinum/vinumrevive.c
+++ b/sys/dev/vinum/vinumrevive.c
@@ -170,7 +170,8 @@ revive_block(int sdno)
else /* it's an unattached plex */
bp->b_dev = VINUM_PLEX(sd->plexno); /* create the device number */
- bp->b_flags = B_READ; /* either way, read it */
+ bp->b_flags = 0; /* either way, read it */
+ bp->b_iocmd = BIO_READ; /* either way, read it */
vinumstart(bp, 1);
biowait(bp);
}
@@ -181,7 +182,8 @@ revive_block(int sdno)
/* Now write to the subdisk */
{
bp->b_dev = VINUM_SD(sdno); /* create the device number */
- bp->b_flags = B_ORDERED | B_WRITE; /* and make this an ordered write */
+ bp->b_flags = B_ORDERED; /* and make this an ordered write */
+ bp->b_iocmd = BIO_WRITE; /* and make this an ordered write */
BUF_LOCKINIT(bp); /* get a lock for the buffer */
BUF_LOCK(bp, LK_EXCLUSIVE); /* and lock it */
bp->b_resid = bp->b_bcount;
@@ -211,7 +213,7 @@ revive_block(int sdno)
"Relaunch revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%x, length %ld\n",
rq->sdno,
rq,
- rq->bp->b_flags & B_READ ? "Read" : "Write",
+ rq->bp->b_flags == BIO_READ ? "Read" : "Write",
major(rq->bp->b_dev),
minor(rq->bp->b_dev),
rq->bp->b_blkno,
@@ -310,8 +312,7 @@ parityops(struct vinum_ioctl_msg *data, enum parityop op)
}
}
} else { /* rebuildparity */
- pbp->b_flags &= ~B_READ;
- pbp->b_flags |= B_WRITE;
+ pbp->b_iocmd = BIO_WRITE;
pbp->b_resid = pbp->b_bcount;
BUF_LOCKINIT(pbp); /* get a lock for the buffer */
BUF_LOCK(pbp, LK_EXCLUSIVE); /* and lock it */
@@ -404,7 +405,8 @@ parityrebuild(struct plex *plex,
bzero(parity_buf, mysize);
}
bpp[sdno]->b_dev = VINUM_SD(plex->sdnos[sdno]); /* device number */
- bpp[sdno]->b_flags = B_READ; /* either way, read it */
+ bpp[sdno]->b_flags = 0; /* either way, read it */
+ bpp[sdno]->b_iocmd = BIO_READ; /* either way, read it */
bpp[sdno]->b_bcount = bpp[sdno]->b_bufsize;
bpp[sdno]->b_resid = bpp[sdno]->b_bcount;
bpp[sdno]->b_blkno = pstripe; /* read from here */
@@ -557,7 +559,7 @@ initsd(int sdno, int verify)
bp->b_resid = bp->b_bcount;
bp->b_blkno = sd->initialized; /* read from here */
bp->b_dev = VINUM_SD(sdno); /* create the device number */
- bp->b_flags |= B_READ; /* read it back */
+ bp->b_iocmd = BIO_READ; /* read it back */
splx(s);
BUF_LOCKINIT(bp); /* get a lock for the buffer */
BUF_LOCK(bp, LK_EXCLUSIVE); /* and lock it */
diff --git a/sys/dev/vinum/vinumstate.c b/sys/dev/vinum/vinumstate.c
index 3ed347f..318e040 100644
--- a/sys/dev/vinum/vinumstate.c
+++ b/sys/dev/vinum/vinumstate.c
@@ -617,7 +617,7 @@ enum requeststatus
checksdstate(struct sd *sd, struct request *rq, daddr_t diskaddr, daddr_t diskend)
{
struct plex *plex = &PLEX[sd->plexno];
- int writeop = (rq->bp->b_flags & B_READ) == 0; /* note if we're writing */
+ int writeop = (rq->bp->b_iocmd == BIO_WRITE); /* note if we're writing */
switch (sd->state) {
/* We shouldn't get called if the subdisk is up */
OpenPOWER on IntegriCloud