repair half-Danish b.b_iocmd damage where writes/reads weren't getting

set properly in the struct buf with vinum:

  Fix locations where B_READ was cleared in the old code but
    b.b_iocmd wasn't set to BIO_WRITE
  Fix propogation of b_iocmd
  Correct comments to reflect reality
  Don't compare b_flags with BIO_READ, it's in b_iocmd.

Submitted by: Bernd Walter <ticso@cicely.de>
This commit is contained in:
Alfred Perlstein 2000-03-26 23:06:12 +00:00
parent fcd9d76716
commit 4bb4aee894
3 changed files with 7 additions and 4 deletions

View File

@ -342,7 +342,8 @@ complete_raid5_write(struct rqelement *rqe)
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_DONE; /* we're writing now */
rqe->b.b_flags &= ~B_DONE; /* we're not done */
rqe->b.b_iocmd = BIO_WRITE; /* 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 */
@ -381,7 +382,8 @@ complete_raid5_write(struct rqelement *rqe)
}
/* Finally, write the parity block */
rqe = &rqg->rqe[0];
rqe->b.b_flags &= ~B_DONE; /* we're writing now */
rqe->b.b_flags &= ~B_DONE; /* we're not done */
rqe->b.b_iocmd = BIO_WRITE; /* 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 */

View File

@ -792,7 +792,7 @@ 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_ASYNC);
bp->b_iocmd = BIO_READ; /* inform us when it's done */
bp->b_iocmd = ubp->b_iocmd;
BUF_LOCKINIT(bp); /* get a lock for the buffer */
BUF_LOCK(bp, LK_EXCLUSIVE); /* and lock it */
@ -921,6 +921,7 @@ sdio(struct buf *bp)
}
bzero(sbp, sizeof(struct sdbuf)); /* start with nothing */
sbp->b.b_flags = bp->b_flags;
sbp->b.b_iocmd = bp->b_iocmd;
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 */

View File

@ -213,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 == BIO_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,