Change the kernel dev_t, representing a pointer to a specinfo structure,
[dragonfly.git] / sys / dev / raid / vinum / vinuminterrupt.c
index ee07ab1..4c409e5 100644 (file)
@@ -41,7 +41,7 @@
  *
  * $Id: vinuminterrupt.c,v 1.12 2000/11/24 03:41:42 grog Exp grog $
  * $FreeBSD: src/sys/dev/vinum/vinuminterrupt.c,v 1.25.2.3 2001/05/28 05:56:27 grog Exp $
- * $DragonFly: src/sys/dev/raid/vinum/vinuminterrupt.c,v 1.6 2006/02/17 19:18:06 dillon Exp $
+ * $DragonFly: src/sys/dev/raid/vinum/vinuminterrupt.c,v 1.11 2006/09/10 01:26:36 dillon Exp $
  */
 
 #include "vinumhdr.h"
@@ -96,16 +96,16 @@ complete_rqe(struct bio *bio)
        else if (rq->error == 0)                            /* no: do we have one already? */
            rq->error = EIO;                                /* no: catchall "I/O error" */
        sd->lasterror = rq->error;
-       if (bp->b_flags & B_READ) {
+       if (bp->b_cmd == BUF_CMD_READ) {
            if ((rq->error == ENXIO) || (sd->flags & VF_RETRYERRORS) == 0) {
                gravity = " fatal";
                set_sd_state(rqe->sdno, sd_crashed, setstate_force); /* subdisk is crashed */
            }
            log(LOG_ERR,
-               "%s:%s read error, block %d for %ld bytes\n",
+               "%s:%s read error, offset %lld for %d bytes\n",
                gravity,
                sd->name,
-               bio->bio_blkno,
+               bio->bio_offset,
                bp->b_bcount);
        } else {                                            /* write operation */
            if ((rq->error == ENXIO) || (sd->flags & VF_RETRYERRORS) == 0) {
@@ -113,22 +113,22 @@ complete_rqe(struct bio *bio)
                set_sd_state(rqe->sdno, sd_stale, setstate_force); /* subdisk is stale */
            }
            log(LOG_ERR,
-               "%s:%s write error, block %d for %ld bytes\n",
+               "%s:%s write error, offset %lld for %d bytes\n",
                gravity,
                sd->name,
-               bio->bio_blkno,
+               bio->bio_offset,
                bp->b_bcount);
        }
        log(LOG_ERR,
-           "%s: user buffer block %d for %ld bytes\n",
+           "%s: user buffer offset %lld for %d bytes\n",
            sd->name,
-           ubio->bio_blkno,
+           ubio->bio_offset,
            ubio->bio_buf->b_bcount);
        if (rq->error == ENXIO) {                           /* the drive's down too */
            log(LOG_ERR,
-               "%s: fatal drive I/O error, block %d for %ld bytes\n",
+               "%s: fatal drive I/O error, offset %lld for %d bytes\n",
                DRIVE[rqe->driveno].label.name,
-               bio->bio_blkno,
+               bio->bio_offset,
                bp->b_bcount);
            DRIVE[rqe->driveno].lasterror = rq->error;
            set_drive_state(rqe->driveno,                   /* take the drive down */
@@ -137,7 +137,7 @@ complete_rqe(struct bio *bio)
        }
     }
     /* Now update the statistics */
-    if (bp->b_flags & B_READ) {                                    /* read operation */
+    if (bp->b_cmd == BUF_CMD_READ) {                           /* read operation */
        DRIVE[rqe->driveno].reads++;
        DRIVE[rqe->driveno].bytes_read += bp->b_bcount;
        SD[rqe->sdno].reads++;
@@ -273,7 +273,7 @@ sdio_done(struct bio *bio)
 #endif
     sbp->bio->bio_buf->b_resid = sbp->b.b_resid;                           /* copy the resid field */
     /* Now update the statistics */
-    if (sbp->b.b_flags & B_READ) {                         /* read operation */
+    if (sbp->b.b_cmd == BUF_CMD_READ) {                            /* read operation */
        DRIVE[sbp->driveno].reads++;
        DRIVE[sbp->driveno].bytes_read += sbp->b.b_bcount;
        SD[sbp->sdno].reads++;
@@ -305,7 +305,7 @@ complete_raid5_write(struct rqelement *rqe)
     struct rqgroup *rqg;                                   /* and to the request group */
     struct rqelement *prqe;                                /* point to the parity block */
     struct drive *drive;                                   /* drive to access */
-    dev_t dev;
+    cdev_t dev;
 
     rqg = rqe->rqg;                                        /* and to our request group */
     rq = rqg->rq;                                          /* point to our request */
@@ -384,16 +384,15 @@ 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_cmd == BUF_CMD_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_cmd = BUF_CMD_WRITE;   /* we're writing now */
                    rqe->b.b_bio1.bio_done = complete_rqe;          /* by calling us here */
                    rqe->flags &= ~XFR_PARITYOP;            /* reset flags that brought us here */
                    rqe->b.b_data = &ubio->bio_buf->b_data[rqe->useroffset << DEV_BSHIFT]; /* point to the user data */
                    rqe->b.b_bcount = rqe->datalen << DEV_BSHIFT; /* length to write */
-                   rqe->b.b_bufsize = rqe->b.b_bcount;     /* don't claim more */
                    rqe->b.b_resid = rqe->b.b_bcount;       /* nothing transferred */
-                   rqe->b.b_bio1.bio_blkno += rqe->dataoffset;     /* point to the correct block */
+                   rqe->b.b_bio1.bio_offset += (off_t)rqe->dataoffset << DEV_BSHIFT;       /* point to the correct block */
                    dev = DRIVE[rqe->driveno].dev;
                    rqe->b.b_bio1.bio_driver_info = dev;
                    rqg->active++;                          /* another active request */
@@ -409,13 +408,13 @@ complete_raid5_write(struct rqelement *rqe)
 #if VINUMDEBUG
                    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",
+                           "  %s dev %d.%d, sd %d, offset 0x%llx, devoffset 0x%llx, length %d\n",
+                           (rqe->b.b_cmd == BUF_CMD_READ) ? "Read" : "Write",
                            major(dev),
                            minor(dev),
                            rqe->sdno,
-                           (u_int) (rqe->b.b_bio1.bio_blkno - SD[rqe->sdno].driveoffset),
-                           rqe->b.b_bio1.bio_blkno,
+                           rqe->b.b_bio1.bio_offset - ((off_t)SD[rqe->sdno].driveoffset << DEV_BSHIFT),
+                           rqe->b.b_bio1.bio_offset,
                            rqe->b.b_bcount);
                    if (debug & DEBUG_LASTREQS)
                        logrq(loginfo_raid5_data, (union rqinfou) rqe, ubio);
@@ -427,11 +426,10 @@ 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_cmd = BUF_CMD_WRITE;                  /* we're writing now */
     rqe->b.b_bio1.bio_done = complete_rqe;                         /* by calling us here */
     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 */
     rqe->b.b_resid = rqe->b.b_bcount;                      /* nothing transferred */
     dev = DRIVE[rqe->driveno].dev;
     rqe->b.b_bio1.bio_driver_info = dev;
@@ -449,13 +447,13 @@ complete_raid5_write(struct rqelement *rqe)
 #if VINUMDEBUG
     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",
+           "  %s dev %d.%d, sd %d, offset 0x%llx, devoffset 0x%llx, length %d\n",
+           (rqe->b.b_cmd == BUF_CMD_READ) ? "Read" : "Write",
            major(dev),
            minor(dev),
            rqe->sdno,
-           (u_int) (rqe->b.b_bio1.bio_blkno - SD[rqe->sdno].driveoffset),
-           rqe->b.b_bio1.bio_blkno,
+           rqe->b.b_bio1.bio_offset - ((off_t)SD[rqe->sdno].driveoffset << DEV_BSHIFT),
+           rqe->b.b_bio1.bio_offset,
            rqe->b.b_bcount);
     if (debug & DEBUG_LASTREQS)
        logrq(loginfo_raid5_parity, (union rqinfou) rqe, ubio);