From 512eb59d710b73a5f87a05d797a5dc0c2486ed2b Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 17 Feb 2021 09:34:20 +0000 Subject: Pull up following revision(s) (requested by oster in ticket #1206): sys/dev/raidframe/rf_reconstruct.c: revision 1.125 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. --- sys/dev/raidframe/rf_reconstruct.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sys/dev/raidframe') diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index a80f144c10e..74ad96f1033 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.122 2019/02/09 03:34:00 christos Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.122.4.1 2021/02/17 09:34:20 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.122 2019/02/09 03:34:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.122.4.1 2021/02/17 09:34:20 martin Exp $"); #include #include @@ -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) { -- cgit