summaryrefslogtreecommitdiff
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-03-29 11:46:46 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-03-29 11:46:46 +0000
commit47402ef2aa149da75c4b1dba5a74866f852074f1 (patch)
treef23724f075a2b791b99b797373affa842c135295 /sys/dev/softraid.c
parent8673b11d01f804ff5d1c8397d6a911754b8b9c55 (diff)
sd_wu_pending is only decremented when scsi_done() or scsi_io_put() are
called. As a result, factor out the the sd_sync check/wakeup code and move it to after the scsi_done() call in sr_scsi_done(). Perform the same sd_sync check/wakeup after scsi_io_put() calls (including the addition of some that were previously missed). ok krw@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 74d7f37a6fb..380d8032cb2 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.291 2013/03/25 16:01:48 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.292 2013/03/29 11:46:43 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -2278,16 +2278,11 @@ sr_wu_done_callback(void *arg1, void *arg2)
* If a discipline provides its own sd_scsi_done function, then it
* is responsible for calling sr_scsi_done() once I/O is complete.
*/
- if (sd->sd_scsi_done) {
+ if (sd->sd_scsi_done)
sd->sd_scsi_done(wu);
- } else {
+ else
sr_scsi_done(sd, xs);
- /* XXX - move to sr_scsi_done? */
- if (sd->sd_sync && sd->sd_wu_pending == 0)
- wakeup(sd);
- }
-
splx(s);
}
@@ -2300,6 +2295,9 @@ sr_scsi_done(struct sr_discipline *sd, struct scsi_xfer *xs)
xs->resid = 0;
scsi_done(xs);
+
+ if (sd->sd_sync && sd->sd_wu_pending == 0)
+ wakeup(sd);
}
void
@@ -4068,15 +4066,14 @@ sr_raid_sync(struct sr_workunit *wu)
s = splbio();
sd->sd_sync = 1;
-
- while (sd->sd_wu_pending > ios)
+ while (sd->sd_wu_pending > ios) {
if (tsleep(sd, PRIBIO, "sr_sync", 15 * hz) == EWOULDBLOCK) {
DNPRINTF(SR_D_DIS, "%s: sr_raid_sync timeout\n",
DEVNAME(sd->sd_sc));
rv = 1;
break;
}
-
+ }
sd->sd_sync = 0;
splx(s);
@@ -4611,6 +4608,9 @@ queued:
scsi_io_put(&sd->sd_iopool, wu_r);
scsi_io_put(&sd->sd_iopool, wu_w);
+ if (sd->sd_sync && sd->sd_wu_pending == 0)
+ wakeup(sd);
+
sd->sd_meta->ssd_rebuild = lba;
/* save metadata every percent */