diff options
author | 2013-04-26 15:45:35 +0000 | |
---|---|---|
committer | 2013-04-26 15:45:35 +0000 | |
commit | 19d5807363573486e21c3b35e0ec8f29d8a88a06 (patch) | |
tree | fea6e1cb5d4ef19cbebc5e5c936d4959e18ee1e6 | |
parent | Don't use usbd_bulk_transfer() to submit a synchronous transfer here too. (diff) | |
download | wireguard-openbsd-19d5807363573486e21c3b35e0ec8f29d8a88a06.tar.xz wireguard-openbsd-19d5807363573486e21c3b35e0ec8f29d8a88a06.zip |
Add a SR_WUF_DISCIPLINE flag that identifies work units that have resulted
from discipline specific I/O. Such work units are not associated with a
SCSI xfer and are returned via sr_wu_put() on completion.
-rw-r--r-- | sys/dev/softraid.c | 21 | ||||
-rw-r--r-- | sys/dev/softraid_raid6.c | 18 | ||||
-rw-r--r-- | sys/dev/softraid_raidp.c | 18 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 3 |
4 files changed, 34 insertions, 26 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index b63ba7ed547..ce0d771fb61 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.301 2013/04/23 12:49:52 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.302 2013/04/26 15:45:35 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2253,12 +2253,21 @@ sr_wu_done_callback(void *arg1, void *arg2) struct sr_workunit *wup; int s; + /* + * The SR_WUF_DISCIPLINE or SR_WUF_REBUILD flag must be set if + * the work unit is not associated with a scsi_xfer. + */ + KASSERT(xs != NULL || + (wu->swu_flags & (SR_WUF_DISCIPLINE|SR_WUF_REBUILD))); + s = splbio(); - if (wu->swu_ios_failed) - xs->error = XS_DRIVER_STUFFUP; - else - xs->error = XS_NOERROR; + if (xs != NULL) { + if (wu->swu_ios_failed) + xs->error = XS_DRIVER_STUFFUP; + else + xs->error = XS_NOERROR; + } if (sd->sd_scsi_wu_done) { if (sd->sd_scsi_wu_done(wu) == SR_WU_RESTART) @@ -2294,6 +2303,8 @@ sr_wu_done_callback(void *arg1, void *arg2) wakeup(wu); if (sd->sd_scsi_done) sd->sd_scsi_done(wu); + else if (wu->swu_flags & SR_WUF_DISCIPLINE) + sr_scsi_wu_put(sd, wu); else if (!(wu->swu_flags & SR_WUF_REBUILD)) sr_scsi_done(sd, xs); diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c index 86e67308b85..5eb581b0337 100644 --- a/sys/dev/softraid_raid6.c +++ b/sys/dev/softraid_raid6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid6.c,v 1.47 2013/04/23 13:36:19 jsing Exp $ */ +/* $OpenBSD: softraid_raid6.c,v 1.48 2013/04/26 15:45:35 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -398,12 +398,13 @@ sr_raid6_rw(struct sr_workunit *wu) datalen = xs->datalen; lbaoffs = blk << DEV_BSHIFT; - if (xs->flags & SCSI_DATA_OUT) - /* create write workunit */ + if (xs->flags & SCSI_DATA_OUT) { if ((wu_r = sr_scsi_wu_get(sd, SCSI_NOSLEEP)) == NULL){ printf("%s: can't get wu_r", DEVNAME(sd->sd_sc)); goto bad; } + wu_r->swu_flags |= SR_WUF_DISCIPLINE; + } wu->swu_blk_start = 0; while (datalen != 0) { @@ -764,13 +765,10 @@ sr_raid6_intr(struct buf *bp) wu->swu_flags |= SR_WUF_REBUILDIOCOMP; if (wu->swu_flags & SR_WUF_WAKEUP) wakeup(wu); - if (!(wu->swu_flags & SR_WUF_REBUILD)) { - if (xs == NULL) { - sr_scsi_wu_put(sd, wu); - } else { - sr_scsi_done(sd, xs); - } - } + if (wu->swu_flags & SR_WUF_DISCIPLINE) + sr_scsi_wu_put(sd, wu); + else if (!(wu->swu_flags & SR_WUF_REBUILD)) + sr_scsi_done(sd, xs); done: splx(s); diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c index 25e3596099e..323095f7d21 100644 --- a/sys/dev/softraid_raidp.c +++ b/sys/dev/softraid_raidp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raidp.c,v 1.44 2013/04/23 13:35:08 jsing Exp $ */ +/* $OpenBSD: softraid_raidp.c,v 1.45 2013/04/26 15:45:35 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -353,12 +353,13 @@ sr_raidp_rw(struct sr_workunit *wu) datalen = xs->datalen; lbaoffs = blk << DEV_BSHIFT; - if (xs->flags & SCSI_DATA_OUT) - /* create write workunit */ + if (xs->flags & SCSI_DATA_OUT) { if ((wu_r = sr_scsi_wu_get(sd, SCSI_NOSLEEP)) == NULL){ printf("%s: can't get wu_r", DEVNAME(sd->sd_sc)); goto bad; } + wu_r->swu_flags |= SR_WUF_DISCIPLINE; + } wu->swu_blk_start = 0; while (datalen != 0) { @@ -593,13 +594,10 @@ sr_raidp_intr(struct buf *bp) wu->swu_flags |= SR_WUF_REBUILDIOCOMP; if (wu->swu_flags & SR_WUF_WAKEUP) wakeup(wu); - if (!(wu->swu_flags & SR_WUF_REBUILD)) { - if (xs == NULL) { - sr_scsi_wu_put(sd, wu); - } else { - sr_scsi_done(sd, xs); - } - } + if (wu->swu_flags & SR_WUF_DISCIPLINE) + sr_scsi_wu_put(sd, wu); + else if (!(wu->swu_flags & SR_WUF_REBUILD)) + sr_scsi_done(sd, xs); done: splx(s); diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index fe8f9e34867..ac3be994c05 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.135 2013/04/23 12:49:52 jsing Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.136 2013/04/26 15:45:35 jsing Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -386,6 +386,7 @@ struct sr_workunit { #define SR_WUF_FAIL (1<<2) /* RAID6: failure */ #define SR_WUF_FAILIOCOMP (1<<3) #define SR_WUF_WAKEUP (1<<4) /* Wakeup on I/O completion. */ +#define SR_WUF_DISCIPLINE (1<<5) /* Discipline specific I/O. */ int swu_fake; /* faked wu */ /* workunit io range */ |