diff options
| author | oster <oster@NetBSD.org> | 2021-02-15 23:27:03 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2021-02-15 23:27:03 +0000 |
| commit | fc5239162468d875307c2a088c72ab536afa15f8 (patch) | |
| tree | fb4bb9e1f3e8dd56942e1a67c49e76cb00e1a45d /sys/dev/raidframe | |
| parent | e3b491b0df67904377852291563b3055b2004d8d (diff) | |
Fix a long long-standing off-by-one error in computing lastPSID.
SUsPerPU is only really supported for a value of 1, and since the
first PSID is 0, the last will be numStripe-1. Also update the
setting of pending_writes to reflect the change to lastPSID.
Needs pullups to -8 and -9.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_reconstruct.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index 03f48879b2c..f2db04253d3 100644 --- a/sys/dev/raidframe/rf_reconstruct.c +++ b/sys/dev/raidframe/rf_reconstruct.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.125 2021/02/15 23:27:03 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.125 2021/02/15 23:27:03 oster Exp $"); #include <sys/param.h> #include <sys/time.h> @@ -616,7 +616,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) mapPtr = raidPtr->reconControl->reconMap; incPSID = RF_RECONMAP_SIZE; - lastPSID = raidPtr->Layout.numStripe / raidPtr->Layout.SUsPerPU; + lastPSID = raidPtr->Layout.numStripe / raidPtr->Layout.SUsPerPU - 1; RUsPerPU = raidPtr->Layout.SUsPerPU / raidPtr->Layout.SUsPerRU; recon_error = 0; write_error = 0; @@ -631,7 +631,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) raidPtr->reconControl->lastPSID = lastPSID; if (pending_writes > lastPSID) - pending_writes = lastPSID; + pending_writes = lastPSID + 1; /* start the actual reconstruction */ @@ -796,7 +796,6 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) pending_writes = lastPSID - prev; raidPtr->reconControl->lastPSID = lastPSID; } - /* back down curPSID to get ready for the next round... */ for (i = 0; i < raidPtr->numCol; i++) { if (i != col) { |
