diff options
-rw-r--r-- | sys/dev/softraid_raid0.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c index a94462b02c0..ae0e846fc16 100644 --- a/sys/dev/softraid_raid0.c +++ b/sys/dev/softraid_raid0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid0.c,v 1.31 2013/01/17 04:07:39 jsing Exp $ */ +/* $OpenBSD: softraid_raid0.c,v 1.32 2013/01/18 06:49:16 jsing Exp $ */ /* * Copyright (c) 2008 Marco Peereboom <marco@peereboom.us> * @@ -250,10 +250,10 @@ sr_raid0_intr(struct buf *bp) struct sr_discipline *sd = wu->swu_dis; struct scsi_xfer *xs = wu->swu_xs; struct sr_softc *sc = sd->sd_sc; - int s, pend; + int s; - DNPRINTF(SR_D_INTR, "%s: sr_intr bp %x xs %x\n", - DEVNAME(sc), bp, xs); + DNPRINTF(SR_D_INTR, "%s: %s %s intr bp %x xs %x\n", + DEVNAME(sc), sd->sd_meta.ssd_name, sd->sd_name, bp, xs); s = splbio(); @@ -264,34 +264,29 @@ sr_raid0_intr(struct buf *bp) wu->swu_ios_failed); if (wu->swu_ios_complete >= wu->swu_io_count) { - if (wu->swu_ios_failed) - goto bad; - - xs->error = XS_NOERROR; - - pend = 0; - TAILQ_FOREACH(wup, &sd->sd_wu_pendq, swu_link) { - if (wu == wup) { - /* wu on pendq, remove */ - TAILQ_REMOVE(&sd->sd_wu_pendq, wu, swu_link); - pend = 1; - - if (wu->swu_collider) { - /* restart deferred wu */ - wu->swu_collider->swu_state = - SR_WU_INPROGRESS; - TAILQ_REMOVE(&sd->sd_wu_defq, - wu->swu_collider, swu_link); - sr_raid_startwu(wu->swu_collider); - } + TAILQ_FOREACH(wup, &sd->sd_wu_pendq, swu_link) + if (wup == wu) break; - } - } - if (!pend) - printf("%s: wu: %p not on pending queue\n", + if (wup == NULL) + panic("%s: wu %p not on pending queue", DEVNAME(sc), wu); + TAILQ_REMOVE(&sd->sd_wu_pendq, wu, swu_link); + + if (wu->swu_collider) { + /* restart deferred wu */ + wu->swu_collider->swu_state = SR_WU_INPROGRESS; + TAILQ_REMOVE(&sd->sd_wu_defq, + wu->swu_collider, swu_link); + sr_raid_startwu(wu->swu_collider); + } + + if (wu->swu_ios_failed) + xs->error = XS_DRIVER_STUFFUP; + else + xs->error = XS_NOERROR; + sr_scsi_done(sd, xs); if (sd->sd_sync && sd->sd_wu_pending == 0) @@ -299,9 +294,4 @@ sr_raid0_intr(struct buf *bp) } splx(s); - return; -bad: - xs->error = XS_DRIVER_STUFFUP; - sr_scsi_done(sd, xs); - splx(s); } |