summaryrefslogtreecommitdiff
path: root/sys/dev/softraid_crypto.c
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2008-02-05 16:49:26 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2008-02-05 16:49:26 +0000
commit6efcb5353e2a858c7b4ce8ea28567db393411616 (patch)
treedb78619bdc43d1da9b3e9c7227091a65b24cf65a /sys/dev/softraid_crypto.c
parent160689e7f2fa5c1b58b2a09c19be1a697f55235d (diff)
Shave off a few more bytes by moving IO collision detection into a generic
fucntion. Fix bug in the crypto code that could casuse data corruption as a bonus, bad cut & past tedu!
Diffstat (limited to 'sys/dev/softraid_crypto.c')
-rw-r--r--sys/dev/softraid_crypto.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index 44629f93879..28979c249cf 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.7 2008/02/05 16:15:35 marco Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.8 2008/02/05 16:49:25 marco Exp $ */
/*
* Copyright (c) 2007 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2008 Marco Peereboom <marco@openbsd.org>
@@ -240,7 +240,6 @@ sr_crypto_rw2(struct sr_workunit *wu, struct cryptop *crp)
{
struct sr_discipline *sd = wu->swu_dis;
struct scsi_xfer *xs = wu->swu_xs;
- struct sr_workunit *wup;
struct sr_ccb *ccb;
struct uio *uio;
int s;
@@ -299,25 +298,10 @@ sr_crypto_rw2(struct sr_workunit *wu, struct cryptop *crp)
ccb->ccb_buf.b_flags, ccb->ccb_buf.b_data);
- /* walk queue backwards and fill in collider if we have one */
s = splbio();
- TAILQ_FOREACH_REVERSE(wup, &sd->sd_wu_pendq, sr_wu_list, swu_link) {
- if (wu->swu_blk_end < wup->swu_blk_start ||
- wup->swu_blk_end < wu->swu_blk_start)
- continue;
-
- /* we have an LBA collision, defer wu */
- wu->swu_state = SR_WU_DEFERRED;
- if (wup->swu_collider)
- /* wu is on deferred queue, append to last wu */
- while (wup->swu_collider)
- wup = wup->swu_collider;
- wup->swu_collider = wu;
- TAILQ_INSERT_TAIL(&sd->sd_wu_defq, wu, swu_link);
- sd->sd_wu_collisions++;
+ if (sr_check_io_collision(wu))
goto queued;
- }
sr_raid_startwu(wu);