diff options
author | 2013-01-16 07:07:38 +0000 | |
---|---|---|
committer | 2013-01-16 07:07:38 +0000 | |
commit | 8868790bcea24e93eb592361c1878a27fa05dd27 (patch) | |
tree | 6489760b9c50f3aa261b667d213c89f2aa3e8f67 /sys/dev/softraid.c | |
parent | Add a new capability flag to identify disciplines where read failures are (diff) | |
download | wireguard-openbsd-8868790bcea24e93eb592361c1878a27fa05dd27.tar.xz wireguard-openbsd-8868790bcea24e93eb592361c1878a27fa05dd27.zip |
Add a function that handles the completion of a ccb.
ok krw@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r-- | sys/dev/softraid.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 92e8ccd23fb..ac376b86f2b 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.283 2013/01/16 06:42:22 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.284 2013/01/16 07:07:38 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2051,6 +2051,42 @@ out: return ccb; } +void +sr_ccb_done(struct sr_ccb *ccb) +{ + struct sr_workunit *wu = ccb->ccb_wu; + struct sr_discipline *sd = wu->swu_dis; + struct sr_softc *sc = sd->sd_sc; + + DNPRINTF(SR_D_INTR, "%s: %s %s ccb done b_bcount %d b_resid %d" + " b_flags 0x%0x block %lld target %d\n", + DEVNAME(sc), sd->sd_meta->ssd_devname, sd->sd_name, + ccb->ccb_buf.b_bcount, ccb->ccb_buf.b_resid, ccb->ccb_buf.b_flags, + ccb->ccb_buf.b_blkno, ccb->ccb_target); + + splassert(IPL_BIO); + + if (ccb->ccb_target == -1) + panic("%s: invalid target on wu: %p", DEVNAME(sc), wu); + + if (ccb->ccb_buf.b_flags & B_ERROR) { + DNPRINTF(SR_D_INTR, "%s: i/o error on block %lld target %d\n", + DEVNAME(sc), ccb->ccb_buf.b_blkno, ccb->ccb_target); + if (!ISSET(sd->sd_capabilities, SR_CAP_REDUNDANT)) + printf("%s: i/o error on block %lld target %d " + "b_error %d\n", DEVNAME(sc), ccb->ccb_buf.b_blkno, + ccb->ccb_target, ccb->ccb_buf.b_error); + ccb->ccb_state = SR_CCB_FAILED; + sd->sd_set_chunk_state(sd, ccb->ccb_target, BIOC_SDOFFLINE); + wu->swu_ios_failed++; + } else { + ccb->ccb_state = SR_CCB_OK; + wu->swu_ios_succeeded++; + } + + wu->swu_ios_complete++; +} + int sr_wu_alloc(struct sr_discipline *sd) { |