summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2007-04-17 05:59:21 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2007-04-17 05:59:21 +0000
commiteccf2ab0123eb57afa400867ed54ed22c6fd56aa (patch)
treec4d34dda2c55d115bd35dbed016e8e255ad1ddc0 /sys/dev
parent5534713f430a17cf71fc900d0700ec6a07542f35 (diff)
Shuffle ccb contents and clean up a loop
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/softraid.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 68b01746703..0804e634f89 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.20 2007/04/14 21:28:08 tedu Exp $ */
+/* $OpenBSD: softraid.c,v 1.21 2007/04/17 05:59:20 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -1284,6 +1284,7 @@ sr_raid1_rw(struct sr_workunit *wu)
wu->swu_blk_start = blk;
wu->swu_blk_end = blk + xs->datalen - 1;
+ wu->swu_io_count = ios;
for (i = 0; i < ios; i++) {
ccb = sr_get_ccb(sd);
@@ -1295,6 +1296,23 @@ sr_raid1_rw(struct sr_workunit *wu)
goto bad;
}
+ if (xs->flags & SCSI_POLL) {
+ ccb->ccb_buf.b_flags = 0;
+ ccb->ccb_buf.b_iodone = NULL;
+ } else {
+ ccb->ccb_buf.b_flags = B_CALL;
+ ccb->ccb_buf.b_iodone = sr_raid1_intr;
+ }
+
+ ccb->ccb_buf.b_blkno = blk;
+ ccb->ccb_buf.b_bcount = xs->datalen;
+ ccb->ccb_buf.b_bufsize = xs->datalen;
+ ccb->ccb_buf.b_resid = xs->datalen;
+ ccb->ccb_buf.b_data = xs->data;
+ ccb->ccb_buf.b_error = 0;
+ ccb->ccb_buf.b_proc = curproc;
+ ccb->ccb_wu = wu;
+
if (xs->flags & SCSI_DATA_IN) {
rt = 0;
ragain:
@@ -1335,7 +1353,7 @@ ragain:
case BIOC_SDHOTSPARE: /* should never happen */
case BIOC_SDOFFLINE:
- ios--;
+ wu->swu_io_count--;
sr_put_ccb(ccb);
continue;
@@ -1345,25 +1363,10 @@ ragain:
}
ccb->ccb_target = x;
- ccb->ccb_buf.b_blkno = blk;
- ccb->ccb_buf.b_bcount = xs->datalen;
- ccb->ccb_buf.b_bufsize = xs->datalen;
- ccb->ccb_buf.b_resid = xs->datalen;
- ccb->ccb_buf.b_data = xs->data;
- ccb->ccb_buf.b_error = 0;
- ccb->ccb_buf.b_proc = curproc;
- ccb->ccb_wu = wu;
ccb->ccb_buf.b_dev = sd->sd_vol.sv_chunks[x]->src_dev_mm;
ccb->ccb_buf.b_vp = sd->sd_vol.sv_chunks[x]->src_dev_vn;
- LIST_INIT(&ccb->ccb_buf.b_dep);
- if (xs->flags & SCSI_POLL) {
- ccb->ccb_buf.b_flags = 0;
- ccb->ccb_buf.b_iodone = NULL;
- } else {
- ccb->ccb_buf.b_flags = B_CALL;
- ccb->ccb_buf.b_iodone = sr_raid1_intr;
- }
+ LIST_INIT(&ccb->ccb_buf.b_dep);
TAILQ_INSERT_TAIL(&wu->swu_ccb, ccb, ccb_link);
@@ -1392,7 +1395,6 @@ ragain:
}
#endif
}
- wu->swu_io_count = ios;
/* walk queue backwards and fill in collider if we have one */
s = splbio();