Deleted Added
full compact
geom_ccd.c (58349) geom_ccd.c (58934)
1/* $FreeBSD: head/sys/geom/geom_ccd.c 58349 2000-03-20 11:29:10Z phk $ */
1/* $FreeBSD: head/sys/geom/geom_ccd.c 58934 2000-04-02 15:24:56Z phk $ */
2
3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
4
5/*
6 * Copyright (c) 1995 Jason R. Thorpe.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without

--- 764 unchanged lines hidden (view full) ---

774 struct disklabel *lp;
775
776#ifdef DEBUG
777 if (ccddebug & CCDB_FOLLOW)
778 printf("ccdstrategy(%x): unit %d\n", bp, unit);
779#endif
780 if ((cs->sc_flags & CCDF_INITED) == 0) {
781 bp->b_error = ENXIO;
2
3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
4
5/*
6 * Copyright (c) 1995 Jason R. Thorpe.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without

--- 764 unchanged lines hidden (view full) ---

774 struct disklabel *lp;
775
776#ifdef DEBUG
777 if (ccddebug & CCDB_FOLLOW)
778 printf("ccdstrategy(%x): unit %d\n", bp, unit);
779#endif
780 if ((cs->sc_flags & CCDF_INITED) == 0) {
781 bp->b_error = ENXIO;
782 bp->b_flags |= B_ERROR;
782 bp->b_ioflags |= BIO_ERROR;
783 goto done;
784 }
785
786 /* If it's a nil transfer, wake up the top half now. */
787 if (bp->b_bcount == 0)
788 goto done;
789
790 lp = &cs->sc_label;

--- 17 unchanged lines hidden (view full) ---

808 * If out of bounds return an error. If at the EOF point,
809 * simply read or write less.
810 */
811
812 if (pbn < 0 || pbn >= cs->sc_size) {
813 bp->b_resid = bp->b_bcount;
814 if (pbn != cs->sc_size) {
815 bp->b_error = EINVAL;
783 goto done;
784 }
785
786 /* If it's a nil transfer, wake up the top half now. */
787 if (bp->b_bcount == 0)
788 goto done;
789
790 lp = &cs->sc_label;

--- 17 unchanged lines hidden (view full) ---

808 * If out of bounds return an error. If at the EOF point,
809 * simply read or write less.
810 */
811
812 if (pbn < 0 || pbn >= cs->sc_size) {
813 bp->b_resid = bp->b_bcount;
814 if (pbn != cs->sc_size) {
815 bp->b_error = EINVAL;
816 bp->b_flags |= B_ERROR | B_INVAL;
816 bp->b_flags |= B_INVAL;
817 bp->b_ioflags |= BIO_ERROR;
817 }
818 goto done;
819 }
820
821 /*
822 * If the request crosses EOF, truncate the request.
823 */
824 if (pbn + sz > cs->sc_size) {

--- 278 unchanged lines hidden (view full) ---

1103{
1104#ifdef DEBUG
1105 if (ccddebug & CCDB_FOLLOW)
1106 printf("ccdintr(%x, %x)\n", cs, bp);
1107#endif
1108 /*
1109 * Request is done for better or worse, wakeup the top half.
1110 */
818 }
819 goto done;
820 }
821
822 /*
823 * If the request crosses EOF, truncate the request.
824 */
825 if (pbn + sz > cs->sc_size) {

--- 278 unchanged lines hidden (view full) ---

1104{
1105#ifdef DEBUG
1106 if (ccddebug & CCDB_FOLLOW)
1107 printf("ccdintr(%x, %x)\n", cs, bp);
1108#endif
1109 /*
1110 * Request is done for better or worse, wakeup the top half.
1111 */
1111 if (bp->b_flags & B_ERROR)
1112 if (bp->b_ioflags & BIO_ERROR)
1112 bp->b_resid = bp->b_bcount;
1113 devstat_end_transaction_buf(&cs->device_stats, bp);
1114 biodone(bp);
1115}
1116
1117/*
1118 * Called at interrupt time.
1119 * Mark the component as done and if all components are done,

--- 23 unchanged lines hidden (view full) ---

1143#endif
1144 /*
1145 * If an error occured, report it. If this is a mirrored
1146 * configuration and the first of two possible reads, do not
1147 * set the error in the bp yet because the second read may
1148 * succeed.
1149 */
1150
1113 bp->b_resid = bp->b_bcount;
1114 devstat_end_transaction_buf(&cs->device_stats, bp);
1115 biodone(bp);
1116}
1117
1118/*
1119 * Called at interrupt time.
1120 * Mark the component as done and if all components are done,

--- 23 unchanged lines hidden (view full) ---

1144#endif
1145 /*
1146 * If an error occured, report it. If this is a mirrored
1147 * configuration and the first of two possible reads, do not
1148 * set the error in the bp yet because the second read may
1149 * succeed.
1150 */
1151
1151 if (cbp->cb_buf.b_flags & B_ERROR) {
1152 if (cbp->cb_buf.b_ioflags & BIO_ERROR) {
1152 const char *msg = "";
1153
1154 if ((ccd_softc[unit].sc_cflags & CCDF_MIRROR) &&
1155 (cbp->cb_buf.b_iocmd == BIO_READ) &&
1156 (cbp->cb_pflags & CCDPF_MIRROR_DONE) == 0) {
1157 /*
1158 * We will try our read on the other disk down
1159 * below, also reverse the default pick so if we
1160 * are doing a scan we do not keep hitting the
1161 * bad disk first.
1162 */
1163 struct ccd_softc *cs = &ccd_softc[unit];
1164
1165 msg = ", trying other disk";
1166 cs->sc_pick = 1 - cs->sc_pick;
1167 cs->sc_blk[cs->sc_pick] = bp->b_blkno;
1168 } else {
1153 const char *msg = "";
1154
1155 if ((ccd_softc[unit].sc_cflags & CCDF_MIRROR) &&
1156 (cbp->cb_buf.b_iocmd == BIO_READ) &&
1157 (cbp->cb_pflags & CCDPF_MIRROR_DONE) == 0) {
1158 /*
1159 * We will try our read on the other disk down
1160 * below, also reverse the default pick so if we
1161 * are doing a scan we do not keep hitting the
1162 * bad disk first.
1163 */
1164 struct ccd_softc *cs = &ccd_softc[unit];
1165
1166 msg = ", trying other disk";
1167 cs->sc_pick = 1 - cs->sc_pick;
1168 cs->sc_blk[cs->sc_pick] = bp->b_blkno;
1169 } else {
1169 bp->b_flags |= B_ERROR;
1170 bp->b_ioflags |= BIO_ERROR;
1170 bp->b_error = cbp->cb_buf.b_error ?
1171 cbp->cb_buf.b_error : EIO;
1172 }
1173 printf("ccd%d: error %d on component %d block %d (ccd block %d)%s\n",
1174 unit, bp->b_error, cbp->cb_comp,
1175 (int)cbp->cb_buf.b_blkno, bp->b_blkno, msg);
1176 }
1177

--- 21 unchanged lines hidden (view full) ---

1199 }
1200 } else {
1201 /*
1202 * When reading, either dispose of the second buffer
1203 * or initiate I/O on the second buffer if an error
1204 * occured with this one.
1205 */
1206 if ((cbp->cb_pflags & CCDPF_MIRROR_DONE) == 0) {
1171 bp->b_error = cbp->cb_buf.b_error ?
1172 cbp->cb_buf.b_error : EIO;
1173 }
1174 printf("ccd%d: error %d on component %d block %d (ccd block %d)%s\n",
1175 unit, bp->b_error, cbp->cb_comp,
1176 (int)cbp->cb_buf.b_blkno, bp->b_blkno, msg);
1177 }
1178

--- 21 unchanged lines hidden (view full) ---

1200 }
1201 } else {
1202 /*
1203 * When reading, either dispose of the second buffer
1204 * or initiate I/O on the second buffer if an error
1205 * occured with this one.
1206 */
1207 if ((cbp->cb_pflags & CCDPF_MIRROR_DONE) == 0) {
1207 if (cbp->cb_buf.b_flags & B_ERROR) {
1208 if (cbp->cb_buf.b_ioflags & BIO_ERROR) {
1208 cbp->cb_mirror->cb_pflags |=
1209 CCDPF_MIRROR_DONE;
1210 BUF_STRATEGY(&cbp->cb_mirror->cb_buf);
1211 putccdbuf(cbp);
1212 splx(s);
1213 return;
1214 } else {
1215 putccdbuf(cbp->cb_mirror);

--- 511 unchanged lines hidden ---
1209 cbp->cb_mirror->cb_pflags |=
1210 CCDPF_MIRROR_DONE;
1211 BUF_STRATEGY(&cbp->cb_mirror->cb_buf);
1212 putccdbuf(cbp);
1213 splx(s);
1214 return;
1215 } else {
1216 putccdbuf(cbp->cb_mirror);

--- 511 unchanged lines hidden ---