diff options
| author | ad <ad@NetBSD.org> | 2007-07-29 12:50:17 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-07-29 12:50:17 +0000 |
| commit | eb171eaaa79d6326b947604ed13732b32aedd031 (patch) | |
| tree | 819591fa9b942228faa16370ce3e18f0a14132a9 /sys/dev/raidframe | |
| parent | abf11c212d2132f31c7bde8a89c38aa2719aeb97 (diff) | |
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 16 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_states.c | 5 |
2 files changed, 7 insertions, 14 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 11359d9e1c3..6c0362cd6e9 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.229 2007/07/18 19:04:58 ad Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.230 2007/07/29 12:50:22 ad Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -146,7 +146,7 @@ ***********************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.229 2007/07/18 19:04:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.230 2007/07/29 12:50:22 ad Exp $"); #include <sys/param.h> #include <sys/errno.h> @@ -747,18 +747,15 @@ raidstrategy(struct buf *bp) if ((rs->sc_flags & RAIDF_INITED) ==0) { bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; goto done; } if (raidID >= numraid || !raidPtrs[raidID]) { bp->b_error = ENODEV; - bp->b_flags |= B_ERROR; goto done; } raidPtr = raidPtrs[raidID]; if (!raidPtr->valid) { bp->b_error = ENODEV; - bp->b_flags |= B_ERROR; goto done; } if (bp->b_bcount == 0) { @@ -1861,7 +1858,6 @@ raidstart(RF_Raid_t *raidPtr) if ((sum > raidPtr->totalSectors) || (sum < raid_addr) || (sum < num_blocks) || (sum < pb)) { bp->b_error = ENOSPC; - bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; biodone(bp); RF_LOCK_MUTEX(raidPtr->mutex); @@ -1873,7 +1869,6 @@ raidstart(RF_Raid_t *raidPtr) if (bp->b_bcount & raidPtr->sectorMask) { bp->b_error = EINVAL; - bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; biodone(bp); RF_LOCK_MUTEX(raidPtr->mutex); @@ -1907,7 +1902,6 @@ raidstart(RF_Raid_t *raidPtr) if (rc) { bp->b_error = rc; - bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; biodone(bp); /* continue loop */ @@ -2025,10 +2019,10 @@ KernelWakeupFunc(struct buf *bp) } #endif - /* XXX Ok, let's get aggressive... If B_ERROR is set, let's go + /* XXX Ok, let's get aggressive... If b_error is set, let's go * ballistic, and mark the component as hosed... */ - if (bp->b_flags & B_ERROR) { + if (bp->b_error != 0) { /* Mark the disk as dead */ /* but only mark it once... */ /* and only if it wouldn't leave this RAID set @@ -2055,7 +2049,7 @@ KernelWakeupFunc(struct buf *bp) /* Fill in the error value */ - req->error = (bp->b_flags & B_ERROR) ? bp->b_error : 0; + req->error = bp->b_error; simple_lock(&queue->raidPtr->iodone_lock); diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c index 1c8739b1678..30d65a963dc 100644 --- a/sys/dev/raidframe/rf_states.c +++ b/sys/dev/raidframe/rf_states.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_states.c,v 1.40 2005/12/11 12:23:37 christos Exp $ */ +/* $NetBSD: rf_states.c,v 1.41 2007/07/29 12:50:22 ad Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.40 2005/12/11 12:23:37 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.41 2007/07/29 12:50:22 ad Exp $"); #include <sys/errno.h> @@ -528,7 +528,6 @@ rf_State_CreateDAG(RF_RaidAccessDesc_t *desc) /* skip straight to rf_State_Cleanup() */ desc->state = rf_CleanupState; bp = (struct buf *)desc->bp; - bp->b_flags |= B_ERROR; bp->b_error = EIO; } else { /* bind dags to desc */ |
