summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_reconstruct.c
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2003-12-29 02:38:17 +0000
committeroster <oster@NetBSD.org>2003-12-29 02:38:17 +0000
commit10f077a0fb8ef59202e299d65d807c9e050dd4ff (patch)
tree80ffb9b4d4556ea201be9bb5db9565fca716f29f /sys/dev/raidframe/rf_reconstruct.c
parentd7035f6c9a4cd7330360127a1a450d97de05817e (diff)
[Having received a definite lack of strenuous objection, a small amount
of strenuous agreement, and some general agreement, this commit is going ahead because it's now starting to block some other changes I wish to make.] Remove most of the support for the concept of "rows" from RAIDframe. While the "row" interface has been exported to the world, RAIDframe internals have really only supported a single row, even though they have feigned support of multiple rows. Nothing changes in configuration land -- config files still need to specify a single row, etc. All auto-config structures remain fully forward/backwards compatible. The only visible difference to the average user should be a reduction in the size of a GENERIC kernel (i386) by 4.5K. For those of us trolling through RAIDframe kernel code, a lot of the driver configuration code has become a LOT easier to read.
Diffstat (limited to 'sys/dev/raidframe/rf_reconstruct.c')
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c436
1 files changed, 199 insertions, 237 deletions
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c
index 2487d97678b..5cb1b107f40 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.56 2003/06/29 22:30:34 fvdl Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.57 2003/12/29 02:38:18 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.56 2003/06/29 22:30:34 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.57 2003/12/29 02:38:18 oster Exp $");
#include <sys/time.h>
#include <sys/buf.h>
@@ -102,35 +102,32 @@ static RF_FreeList_t *rf_recond_freelist;
static RF_RaidReconDesc_t *
AllocRaidReconDesc(RF_Raid_t * raidPtr,
- RF_RowCol_t row, RF_RowCol_t col, RF_RaidDisk_t * spareDiskPtr,
- int numDisksDone, RF_RowCol_t srow, RF_RowCol_t scol);
+ RF_RowCol_t col, RF_RaidDisk_t * spareDiskPtr,
+ int numDisksDone, RF_RowCol_t scol);
static void FreeReconDesc(RF_RaidReconDesc_t * reconDesc);
static int
-ProcessReconEvent(RF_Raid_t * raidPtr, RF_RowCol_t frow,
- RF_ReconEvent_t * event);
+ProcessReconEvent(RF_Raid_t * raidPtr, RF_ReconEvent_t * event);
static int
-IssueNextReadRequest(RF_Raid_t * raidPtr, RF_RowCol_t row,
- RF_RowCol_t col);
-static int TryToRead(RF_Raid_t * raidPtr, RF_RowCol_t row, RF_RowCol_t col);
+IssueNextReadRequest(RF_Raid_t * raidPtr, RF_RowCol_t col);
+static int TryToRead(RF_Raid_t * raidPtr, RF_RowCol_t col);
static int
ComputePSDiskOffsets(RF_Raid_t * raidPtr, RF_StripeNum_t psid,
- RF_RowCol_t row, RF_RowCol_t col, RF_SectorNum_t * outDiskOffset,
- RF_SectorNum_t * outFailedDiskSectorOffset, RF_RowCol_t * spRow,
+ RF_RowCol_t col, RF_SectorNum_t * outDiskOffset,
+ RF_SectorNum_t * outFailedDiskSectorOffset,
RF_RowCol_t * spCol, RF_SectorNum_t * spOffset);
-static int IssueNextWriteRequest(RF_Raid_t * raidPtr, RF_RowCol_t row);
+static int IssueNextWriteRequest(RF_Raid_t * raidPtr);
static int ReconReadDoneProc(void *arg, int status);
static int ReconWriteDoneProc(void *arg, int status);
static void
-CheckForNewMinHeadSep(RF_Raid_t * raidPtr, RF_RowCol_t row,
- RF_HeadSepLimit_t hsCtr);
+CheckForNewMinHeadSep(RF_Raid_t * raidPtr, RF_HeadSepLimit_t hsCtr);
static int
CheckHeadSeparation(RF_Raid_t * raidPtr, RF_PerDiskReconCtrl_t * ctrl,
- RF_RowCol_t row, RF_RowCol_t col, RF_HeadSepLimit_t hsCtr,
+ RF_RowCol_t col, RF_HeadSepLimit_t hsCtr,
RF_ReconUnitNum_t which_ru);
static int
CheckForcedOrBlockedReconstruction(RF_Raid_t * raidPtr,
RF_ReconParityStripeStatus_t * pssPtr, RF_PerDiskReconCtrl_t * ctrl,
- RF_RowCol_t row, RF_RowCol_t col, RF_StripeNum_t psid,
+ RF_RowCol_t col, RF_StripeNum_t psid,
RF_ReconUnitNum_t which_ru);
static void ForceReconReadDoneProc(void *arg, int status);
@@ -201,13 +198,11 @@ rf_ConfigureReconstruction(listp)
}
static RF_RaidReconDesc_t *
-AllocRaidReconDesc(raidPtr, row, col, spareDiskPtr, numDisksDone, srow, scol)
+AllocRaidReconDesc(raidPtr, col, spareDiskPtr, numDisksDone, scol)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
RF_RaidDisk_t *spareDiskPtr;
int numDisksDone;
- RF_RowCol_t srow;
RF_RowCol_t scol;
{
@@ -216,11 +211,9 @@ AllocRaidReconDesc(raidPtr, row, col, spareDiskPtr, numDisksDone, srow, scol)
RF_FREELIST_GET(rf_recond_freelist, reconDesc, next, (RF_RaidReconDesc_t *));
reconDesc->raidPtr = raidPtr;
- reconDesc->row = row;
reconDesc->col = col;
reconDesc->spareDiskPtr = spareDiskPtr;
reconDesc->numDisksDone = numDisksDone;
- reconDesc->srow = srow;
reconDesc->scol = scol;
reconDesc->state = 0;
reconDesc->next = NULL;
@@ -255,9 +248,8 @@ FreeReconDesc(reconDesc)
* fails, or is aborted.
*****************************************************************************/
int
-rf_ReconstructFailedDisk(raidPtr, row, col)
+rf_ReconstructFailedDisk(raidPtr, col)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
{
const RF_LayoutSW_t *lp;
@@ -275,7 +267,7 @@ rf_ReconstructFailedDisk(raidPtr, row, col)
}
raidPtr->reconInProgress++;
RF_UNLOCK_MUTEX(raidPtr->mutex);
- rc = rf_ReconstructFailedDiskBasic(raidPtr, row, col);
+ rc = rf_ReconstructFailedDiskBasic(raidPtr, col);
RF_LOCK_MUTEX(raidPtr->mutex);
raidPtr->reconInProgress--;
RF_UNLOCK_MUTEX(raidPtr->mutex);
@@ -289,15 +281,14 @@ rf_ReconstructFailedDisk(raidPtr, row, col)
}
int
-rf_ReconstructFailedDiskBasic(raidPtr, row, col)
+rf_ReconstructFailedDiskBasic(raidPtr, col)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
{
RF_ComponentLabel_t c_label;
RF_RaidDisk_t *spareDiskPtr = NULL;
RF_RaidReconDesc_t *reconDesc;
- RF_RowCol_t srow, scol;
+ RF_RowCol_t scol;
int numDisksDone = 0, rc;
/* first look for a spare drive onto which to reconstruct the data */
@@ -305,35 +296,33 @@ rf_ReconstructFailedDiskBasic(raidPtr, row, col)
* change eventually */
RF_LOCK_MUTEX(raidPtr->mutex);
- RF_ASSERT(raidPtr->Disks[row][col].status == rf_ds_failed);
+ RF_ASSERT(raidPtr->Disks[col].status == rf_ds_failed);
if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
- if (raidPtr->status[row] != rf_rs_degraded) {
- RF_ERRORMSG2("Unable to reconstruct disk at row %d col %d because status not degraded\n", row, col);
+ if (raidPtr->status != rf_rs_degraded) {
+ RF_ERRORMSG1("Unable to reconstruct disk at col %d because status not degraded\n", col);
RF_UNLOCK_MUTEX(raidPtr->mutex);
return (EINVAL);
}
- srow = row;
scol = (-1);
} else {
- srow = 0;
for (scol = raidPtr->numCol; scol < raidPtr->numCol + raidPtr->numSpare; scol++) {
- if (raidPtr->Disks[srow][scol].status == rf_ds_spare) {
- spareDiskPtr = &raidPtr->Disks[srow][scol];
+ if (raidPtr->Disks[scol].status == rf_ds_spare) {
+ spareDiskPtr = &raidPtr->Disks[scol];
spareDiskPtr->status = rf_ds_used_spare;
break;
}
}
if (!spareDiskPtr) {
- RF_ERRORMSG2("Unable to reconstruct disk at row %d col %d because no spares are available\n", row, col);
+ RF_ERRORMSG1("Unable to reconstruct disk at col %d because no spares are available\n", col);
RF_UNLOCK_MUTEX(raidPtr->mutex);
return (ENOSPC);
}
- printf("RECON: initiating reconstruction on row %d col %d -> spare at row %d col %d\n", row, col, srow, scol);
+ printf("RECON: initiating reconstruction on col %d -> spare at col %d\n", col, scol);
}
RF_UNLOCK_MUTEX(raidPtr->mutex);
- reconDesc = AllocRaidReconDesc((void *) raidPtr, row, col, spareDiskPtr, numDisksDone, srow, scol);
+ reconDesc = AllocRaidReconDesc((void *) raidPtr, col, spareDiskPtr, numDisksDone, scol);
raidPtr->reconDesc = (void *) reconDesc;
#if RF_RECON_STATS > 0
reconDesc->hsStallCount = 0;
@@ -349,16 +338,16 @@ rf_ReconstructFailedDiskBasic(raidPtr, row, col)
/* fix up the component label */
/* Don't actually need the read here.. */
raidread_component_label(
- raidPtr->raid_cinfo[srow][scol].ci_dev,
- raidPtr->raid_cinfo[srow][scol].ci_vp,
+ raidPtr->raid_cinfo[scol].ci_dev,
+ raidPtr->raid_cinfo[scol].ci_vp,
&c_label);
raid_init_component_label( raidPtr, &c_label);
- c_label.row = row;
+ c_label.row = 0;
c_label.column = col;
c_label.clean = RF_RAID_DIRTY;
c_label.status = rf_ds_optimal;
- c_label.partitionSize = raidPtr->Disks[srow][scol].partitionSize;
+ c_label.partitionSize = raidPtr->Disks[scol].partitionSize;
/* We've just done a rebuild based on all the other
disks, so at this point the parity is known to be
@@ -373,8 +362,8 @@ rf_ReconstructFailedDiskBasic(raidPtr, row, col)
/* XXXX MORE NEEDED HERE */
raidwrite_component_label(
- raidPtr->raid_cinfo[srow][scol].ci_dev,
- raidPtr->raid_cinfo[srow][scol].ci_vp,
+ raidPtr->raid_cinfo[scol].ci_dev,
+ raidPtr->raid_cinfo[scol].ci_vp,
&c_label);
@@ -396,9 +385,8 @@ rf_ReconstructFailedDiskBasic(raidPtr, row, col)
*/
int
-rf_ReconstructInPlace(raidPtr, row, col)
+rf_ReconstructInPlace(raidPtr, col)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
{
RF_RaidDisk_t *spareDiskPtr = NULL;
@@ -421,11 +409,11 @@ rf_ReconstructInPlace(raidPtr, row, col)
*/
RF_LOCK_MUTEX(raidPtr->mutex);
- if (raidPtr->Disks[row][col].status != rf_ds_failed) {
+ if (raidPtr->Disks[col].status != rf_ds_failed) {
/* "It's gone..." */
raidPtr->numFailures++;
- raidPtr->Disks[row][col].status = rf_ds_failed;
- raidPtr->status[row] = rf_rs_degraded;
+ raidPtr->Disks[col].status = rf_ds_failed;
+ raidPtr->status = rf_rs_degraded;
RF_UNLOCK_MUTEX(raidPtr->mutex);
rf_update_component_labels(raidPtr,
RF_NORMAL_COMPONENT_UPDATE);
@@ -446,11 +434,11 @@ rf_ReconstructInPlace(raidPtr, row, col)
/* Actually, we don't care if it's failed or not...
On a RAID set with correct parity, this function
should be callable on any component without ill affects. */
- /* RF_ASSERT(raidPtr->Disks[row][col].status == rf_ds_failed);
+ /* RF_ASSERT(raidPtr->Disks[col].status == rf_ds_failed);
*/
if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
- RF_ERRORMSG2("Unable to reconstruct to disk at row %d col %d: operation not supported for RF_DISTRIBUTE_SPARE\n", row, col);
+ RF_ERRORMSG1("Unable to reconstruct to disk at col %d: operation not supported for RF_DISTRIBUTE_SPARE\n", col);
raidPtr->reconInProgress--;
RF_UNLOCK_MUTEX(raidPtr->mutex);
@@ -462,32 +450,32 @@ rf_ReconstructInPlace(raidPtr, row, col)
/* This device may have been opened successfully the
first time. Close it before trying to open it again.. */
- if (raidPtr->raid_cinfo[row][col].ci_vp != NULL) {
+ if (raidPtr->raid_cinfo[col].ci_vp != NULL) {
#if 0
printf("Closed the open device: %s\n",
- raidPtr->Disks[row][col].devname);
+ raidPtr->Disks[col].devname);
#endif
- vp = raidPtr->raid_cinfo[row][col].ci_vp;
- ac = raidPtr->Disks[row][col].auto_configured;
+ vp = raidPtr->raid_cinfo[col].ci_vp;
+ ac = raidPtr->Disks[col].auto_configured;
RF_UNLOCK_MUTEX(raidPtr->mutex);
rf_close_component(raidPtr, vp, ac);
RF_LOCK_MUTEX(raidPtr->mutex);
- raidPtr->raid_cinfo[row][col].ci_vp = NULL;
+ raidPtr->raid_cinfo[col].ci_vp = NULL;
}
/* note that this disk was *not* auto_configured (any longer)*/
- raidPtr->Disks[row][col].auto_configured = 0;
+ raidPtr->Disks[col].auto_configured = 0;
#if 0
printf("About to (re-)open the device for rebuilding: %s\n",
- raidPtr->Disks[row][col].devname);
+ raidPtr->Disks[col].devname);
#endif
RF_UNLOCK_MUTEX(raidPtr->mutex);
- retcode = raidlookup(raidPtr->Disks[row][col].devname,
+ retcode = raidlookup(raidPtr->Disks[col].devname,
proc, &vp);
if (retcode) {
printf("raid%d: rebuilding: raidlookup on device: %s failed: %d!\n",raidPtr->raidid,
- raidPtr->Disks[row][col].devname, retcode);
+ raidPtr->Disks[col].devname, retcode);
/* the component isn't responding properly...
must be still dead :-( */
@@ -517,40 +505,37 @@ rf_ReconstructInPlace(raidPtr, row, col)
return(retcode);
}
RF_LOCK_MUTEX(raidPtr->mutex);
- raidPtr->Disks[row][col].blockSize =
+ raidPtr->Disks[col].blockSize =
dpart.disklab->d_secsize;
- raidPtr->Disks[row][col].numBlocks =
+ raidPtr->Disks[col].numBlocks =
dpart.part->p_size - rf_protectedSectors;
- raidPtr->raid_cinfo[row][col].ci_vp = vp;
- raidPtr->raid_cinfo[row][col].ci_dev = va.va_rdev;
+ raidPtr->raid_cinfo[col].ci_vp = vp;
+ raidPtr->raid_cinfo[col].ci_dev = va.va_rdev;
- raidPtr->Disks[row][col].dev = va.va_rdev;
+ raidPtr->Disks[col].dev = va.va_rdev;
/* we allow the user to specify that only a
fraction of the disks should be used this is
just for debug: it speeds up
* the parity scan */
- raidPtr->Disks[row][col].numBlocks =
- raidPtr->Disks[row][col].numBlocks *
+ raidPtr->Disks[col].numBlocks =
+ raidPtr->Disks[col].numBlocks *
rf_sizePercentage / 100;
RF_UNLOCK_MUTEX(raidPtr->mutex);
}
- spareDiskPtr = &raidPtr->Disks[row][col];
+ spareDiskPtr = &raidPtr->Disks[col];
spareDiskPtr->status = rf_ds_used_spare;
- printf("raid%d: initiating in-place reconstruction on\n",
- raidPtr->raidid);
- printf("raid%d: row %d col %d -> spare at row %d col %d\n",
- raidPtr->raidid, row, col, row, col);
+ printf("raid%d: initiating in-place reconstruction on column %d\n", raidPtr->raidid, col);
- reconDesc = AllocRaidReconDesc((void *) raidPtr, row, col,
+ reconDesc = AllocRaidReconDesc((void *) raidPtr, col,
spareDiskPtr, numDisksDone,
- row, col);
+ col);
raidPtr->reconDesc = (void *) reconDesc;
#if RF_RECON_STATS > 0
reconDesc->hsStallCount = 0;
@@ -577,20 +562,20 @@ rf_ReconstructInPlace(raidPtr, row, col)
/* Need to set these here, as at this point it'll be claiming
that the disk is in rf_ds_spared! But we know better :-) */
- raidPtr->Disks[row][col].status = rf_ds_optimal;
- raidPtr->status[row] = rf_rs_optimal;
+ raidPtr->Disks[col].status = rf_ds_optimal;
+ raidPtr->status = rf_rs_optimal;
RF_UNLOCK_MUTEX(raidPtr->mutex);
/* fix up the component label */
/* Don't actually need the read here.. */
- raidread_component_label(raidPtr->raid_cinfo[row][col].ci_dev,
- raidPtr->raid_cinfo[row][col].ci_vp,
+ raidread_component_label(raidPtr->raid_cinfo[col].ci_dev,
+ raidPtr->raid_cinfo[col].ci_vp,
&c_label);
RF_LOCK_MUTEX(raidPtr->mutex);
raid_init_component_label(raidPtr, &c_label);
- c_label.row = row;
+ c_label.row = 0;
c_label.column = col;
/* We've just done a rebuild based on all the other
@@ -602,8 +587,8 @@ rf_ReconstructInPlace(raidPtr, row, col)
raidPtr->parity_good = RF_RAID_CLEAN;
RF_UNLOCK_MUTEX(raidPtr->mutex);
- raidwrite_component_label(raidPtr->raid_cinfo[row][col].ci_dev,
- raidPtr->raid_cinfo[row][col].ci_vp,
+ raidwrite_component_label(raidPtr->raid_cinfo[col].ci_dev,
+ raidPtr->raid_cinfo[col].ci_vp,
&c_label);
rf_update_component_labels(raidPtr,
@@ -620,9 +605,7 @@ rf_ContinueReconstructFailedDisk(reconDesc)
RF_RaidReconDesc_t *reconDesc;
{
RF_Raid_t *raidPtr = reconDesc->raidPtr;
- RF_RowCol_t row = reconDesc->row;
RF_RowCol_t col = reconDesc->col;
- RF_RowCol_t srow = reconDesc->srow;
RF_RowCol_t scol = reconDesc->scol;
RF_ReconMap_t *mapPtr;
RF_ReconCtrl_t *tmp_reconctrl;
@@ -657,22 +640,21 @@ rf_ContinueReconstructFailedDisk(reconDesc)
case 1:
/* allocate our RF_ReconCTRL_t before we protect raidPtr->reconControl[row] */
- tmp_reconctrl = rf_MakeReconControl(reconDesc, row, col, srow, scol);
+ tmp_reconctrl = rf_MakeReconControl(reconDesc, col, scol);
RF_LOCK_MUTEX(raidPtr->mutex);
/* create the reconstruction control pointer and install it in
* the right slot */
- raidPtr->reconControl[row] = tmp_reconctrl;
- mapPtr = raidPtr->reconControl[row]->reconMap;
- raidPtr->status[row] = rf_rs_reconstructing;
- raidPtr->Disks[row][col].status = rf_ds_reconstructing;
- raidPtr->Disks[row][col].spareRow = srow;
- raidPtr->Disks[row][col].spareCol = scol;
+ raidPtr->reconControl = tmp_reconctrl;
+ mapPtr = raidPtr->reconControl->reconMap;
+ raidPtr->status = rf_rs_reconstructing;
+ raidPtr->Disks[col].status = rf_ds_reconstructing;
+ raidPtr->Disks[col].spareCol = scol;
RF_UNLOCK_MUTEX(raidPtr->mutex);
- RF_GETTIME(raidPtr->reconControl[row]->starttime);
+ RF_GETTIME(raidPtr->reconControl->starttime);
/* now start up the actual reconstruction: issue a read for
* each surviving disk */
@@ -682,8 +664,8 @@ rf_ContinueReconstructFailedDisk(reconDesc)
if (i != col) {
/* find and issue the next I/O on the
* indicated disk */
- if (IssueNextReadRequest(raidPtr, row, i)) {
- Dprintf2("RECON: done issuing for r%d c%d\n", row, i);
+ if (IssueNextReadRequest(raidPtr, i)) {
+ Dprintf1("RECON: done issuing for c%d\n", i);
reconDesc->numDisksDone++;
}
}
@@ -700,28 +682,28 @@ rf_ContinueReconstructFailedDisk(reconDesc)
/* process reconstruction events until all disks report that
* they've completed all work */
- mapPtr = raidPtr->reconControl[row]->reconMap;
+ mapPtr = raidPtr->reconControl->reconMap;
while (reconDesc->numDisksDone < raidPtr->numCol - 1) {
- event = rf_GetNextReconEvent(reconDesc, row, (void (*) (void *)) rf_ContinueReconstructFailedDisk, reconDesc);
+ event = rf_GetNextReconEvent(reconDesc, (void (*) (void *)) rf_ContinueReconstructFailedDisk, reconDesc);
RF_ASSERT(event);
- if (ProcessReconEvent(raidPtr, row, event))
+ if (ProcessReconEvent(raidPtr, event))
reconDesc->numDisksDone++;
- raidPtr->reconControl[row]->numRUsTotal =
+ raidPtr->reconControl->numRUsTotal =
mapPtr->totalRUs;
- raidPtr->reconControl[row]->numRUsComplete =
+ raidPtr->reconControl->numRUsComplete =
mapPtr->totalRUs -
rf_UnitsLeftToReconstruct(mapPtr);
- raidPtr->reconControl[row]->percentComplete =
- (raidPtr->reconControl[row]->numRUsComplete * 100 / raidPtr->reconControl[row]->numRUsTotal);
+ raidPtr->reconControl->percentComplete =
+ (raidPtr->reconControl->numRUsComplete * 100 / raidPtr->reconControl->numRUsTotal);
#if RF_DEBUG_RECON
if (rf_prReconSched) {
- rf_PrintReconSchedule(raidPtr->reconControl[row]->reconMap, &(raidPtr->reconControl[row]->starttime));
+ rf_PrintReconSchedule(raidPtr->reconControl->reconMap, &(raidPtr->reconControl->starttime));
}
#endif
}
@@ -732,23 +714,23 @@ rf_ContinueReconstructFailedDisk(reconDesc)
case 4:
- mapPtr = raidPtr->reconControl[row]->reconMap;
+ mapPtr = raidPtr->reconControl->reconMap;
if (rf_reconDebug) {
printf("RECON: all reads completed\n");
}
/* at this point all the reads have completed. We now wait
* for any pending writes to complete, and then we're done */
- while (rf_UnitsLeftToReconstruct(raidPtr->reconControl[row]->reconMap) > 0) {
+ while (rf_UnitsLeftToReconstruct(raidPtr->reconControl->reconMap) > 0) {
- event = rf_GetNextReconEvent(reconDesc, row, (void (*) (void *)) rf_ContinueReconstructFailedDisk, reconDesc);
+ event = rf_GetNextReconEvent(reconDesc, (void (*) (void *)) rf_ContinueReconstructFailedDisk, reconDesc);
RF_ASSERT(event);
- (void) ProcessReconEvent(raidPtr, row, event); /* ignore return code */
- raidPtr->reconControl[row]->percentComplete = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs);
+ (void) ProcessReconEvent(raidPtr, event); /* ignore return code */
+ raidPtr->reconControl->percentComplete = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs);
#if RF_DEBUG_RECON
if (rf_prReconSched) {
- rf_PrintReconSchedule(raidPtr->reconControl[row]->reconMap, &(raidPtr->reconControl[row]->starttime));
+ rf_PrintReconSchedule(raidPtr->reconControl->reconMap, &(raidPtr->reconControl->starttime));
}
#endif
}
@@ -776,11 +758,11 @@ rf_ContinueReconstructFailedDisk(reconDesc)
RF_LOCK_MUTEX(raidPtr->mutex);
raidPtr->numFailures--;
ds = (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE);
- raidPtr->Disks[row][col].status = (ds) ? rf_ds_dist_spared : rf_ds_spared;
- raidPtr->status[row] = (ds) ? rf_rs_reconfigured : rf_rs_optimal;
+ raidPtr->Disks[col].status = (ds) ? rf_ds_dist_spared : rf_ds_spared;
+ raidPtr->status = (ds) ? rf_rs_reconfigured : rf_rs_optimal;
RF_UNLOCK_MUTEX(raidPtr->mutex);
RF_GETTIME(etime);
- RF_TIMEVAL_DIFF(&(raidPtr->reconControl[row]->starttime), &etime, &elpsd);
+ RF_TIMEVAL_DIFF(&(raidPtr->reconControl->starttime), &etime, &elpsd);
/* XXX -- why is state 7 different from state 6 if there is no
* return() here? -- XXX Note that I set elpsd above & use it
@@ -791,8 +773,8 @@ rf_ContinueReconstructFailedDisk(reconDesc)
rf_ResumeNewRequests(raidPtr);
- printf("raid%d: Reconstruction of disk at row %d col %d completed\n",
- raidPtr->raidid, row, col);
+ printf("raid%d: Reconstruction of disk at col %d completed\n",
+ raidPtr->raidid, col);
xor_s = raidPtr->accumXorTimeUs / 1000000;
xor_resid_us = raidPtr->accumXorTimeUs % 1000000;
printf("raid%d: Recon time was %d.%06d seconds, accumulated XOR time was %ld us (%ld.%06ld)\n",
@@ -801,15 +783,15 @@ rf_ContinueReconstructFailedDisk(reconDesc)
raidPtr->accumXorTimeUs, xor_s, xor_resid_us);
printf("raid%d: (start time %d sec %d usec, end time %d sec %d usec)\n",
raidPtr->raidid,
- (int) raidPtr->reconControl[row]->starttime.tv_sec,
- (int) raidPtr->reconControl[row]->starttime.tv_usec,
+ (int) raidPtr->reconControl->starttime.tv_sec,
+ (int) raidPtr->reconControl->starttime.tv_usec,
(int) etime.tv_sec, (int) etime.tv_usec);
#if RF_RECON_STATS > 0
printf("raid%d: Total head-sep stall count was %d\n",
raidPtr->raidid, (int) reconDesc->hsStallCount);
#endif /* RF_RECON_STATS > 0 */
- rf_FreeReconControl(raidPtr, row);
+ rf_FreeReconControl(raidPtr);
RF_Free(raidPtr->recon_tracerecs, raidPtr->numCol * sizeof(RF_AccTraceEntry_t));
FreeReconDesc(reconDesc);
@@ -824,9 +806,8 @@ rf_ContinueReconstructFailedDisk(reconDesc)
* indicated disk
*****************************************************************************/
static int
-ProcessReconEvent(raidPtr, frow, event)
+ProcessReconEvent(raidPtr, event)
RF_Raid_t *raidPtr;
- RF_RowCol_t frow;
RF_ReconEvent_t *event;
{
int retcode = 0, submitblocked;
@@ -838,9 +819,9 @@ ProcessReconEvent(raidPtr, frow, event)
/* a read I/O has completed */
case RF_REVENT_READDONE:
- rbuf = raidPtr->reconControl[frow]->perDiskInfo[event->col].rbuf;
- Dprintf3("RECON: READDONE EVENT: row %d col %d psid %ld\n",
- frow, event->col, rbuf->parityStripeID);
+ rbuf = raidPtr->reconControl->perDiskInfo[event->col].rbuf;
+ Dprintf2("RECON: READDONE EVENT: col %d psid %ld\n",
+ event->col, rbuf->parityStripeID);
Dprintf7("RECON: done read psid %ld buf %lx %02x %02x %02x %02x %02x\n",
rbuf->parityStripeID, rbuf->buffer, rbuf->buffer[0] & 0xff, rbuf->buffer[1] & 0xff,
rbuf->buffer[2] & 0xff, rbuf->buffer[3] & 0xff, rbuf->buffer[4] & 0xff);
@@ -848,7 +829,7 @@ ProcessReconEvent(raidPtr, frow, event)
submitblocked = rf_SubmitReconBuffer(rbuf, 0, 0);
Dprintf1("RECON: submitblocked=%d\n", submitblocked);
if (!submitblocked)
- retcode = IssueNextReadRequest(raidPtr, frow, event->col);
+ retcode = IssueNextReadRequest(raidPtr, event->col);
break;
/* a write I/O has completed */
@@ -862,16 +843,16 @@ ProcessReconEvent(raidPtr, frow, event)
rbuf = (RF_ReconBuffer_t *) event->arg;
rf_FreeDiskQueueData((RF_DiskQueueData_t *) rbuf->arg);
Dprintf3("RECON: WRITEDONE EVENT: psid %d ru %d (%d %% complete)\n",
- rbuf->parityStripeID, rbuf->which_ru, raidPtr->reconControl[frow]->percentComplete);
- rf_ReconMapUpdate(raidPtr, raidPtr->reconControl[frow]->reconMap,
+ rbuf->parityStripeID, rbuf->which_ru, raidPtr->reconControl->percentComplete);
+ rf_ReconMapUpdate(raidPtr, raidPtr->reconControl->reconMap,
rbuf->failedDiskSectorOffset, rbuf->failedDiskSectorOffset + sectorsPerRU - 1);
- rf_RemoveFromActiveReconTable(raidPtr, frow, rbuf->parityStripeID, rbuf->which_ru);
+ rf_RemoveFromActiveReconTable(raidPtr, rbuf->parityStripeID, rbuf->which_ru);
if (rbuf->type == RF_RBUF_TYPE_FLOATING) {
- RF_LOCK_MUTEX(raidPtr->reconControl[frow]->rb_mutex);
+ RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
raidPtr->numFullReconBuffers--;
- rf_ReleaseFloatingReconBuffer(raidPtr, frow, rbuf);
- RF_UNLOCK_MUTEX(raidPtr->reconControl[frow]->rb_mutex);
+ rf_ReleaseFloatingReconBuffer(raidPtr, rbuf);
+ RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex);
} else
if (rbuf->type == RF_RBUF_TYPE_FORCED)
rf_FreeReconBuffer(rbuf);
@@ -881,31 +862,31 @@ ProcessReconEvent(raidPtr, frow, event)
case RF_REVENT_BUFCLEAR: /* A buffer-stall condition has been
* cleared */
- Dprintf2("RECON: BUFCLEAR EVENT: row %d col %d\n", frow, event->col);
- submitblocked = rf_SubmitReconBuffer(raidPtr->reconControl[frow]->perDiskInfo[event->col].rbuf, 0, (int) (long) event->arg);
+ Dprintf1("RECON: BUFCLEAR EVENT: col %d\n", event->col);
+ submitblocked = rf_SubmitReconBuffer(raidPtr->reconControl->perDiskInfo[event->col].rbuf, 0, (int) (long) event->arg);
RF_ASSERT(!submitblocked); /* we wouldn't have gotten the
* BUFCLEAR event if we
* couldn't submit */
- retcode = IssueNextReadRequest(raidPtr, frow, event->col);
+ retcode = IssueNextReadRequest(raidPtr, event->col);
break;
case RF_REVENT_BLOCKCLEAR: /* A user-write reconstruction
* blockage has been cleared */
- DDprintf2("RECON: BLOCKCLEAR EVENT: row %d col %d\n", frow, event->col);
- retcode = TryToRead(raidPtr, frow, event->col);
+ DDprintf1("RECON: BLOCKCLEAR EVENT: col %d\n", event->col);
+ retcode = TryToRead(raidPtr, event->col);
break;
case RF_REVENT_HEADSEPCLEAR: /* A max-head-separation
* reconstruction blockage has been
* cleared */
- Dprintf2("RECON: HEADSEPCLEAR EVENT: row %d col %d\n", frow, event->col);
- retcode = TryToRead(raidPtr, frow, event->col);
+ Dprintf1("RECON: HEADSEPCLEAR EVENT: col %d\n", event->col);
+ retcode = TryToRead(raidPtr, event->col);
break;
/* a buffer has become ready to write */
case RF_REVENT_BUFREADY:
- Dprintf2("RECON: BUFREADY EVENT: row %d col %d\n", frow, event->col);
- retcode = IssueNextWriteRequest(raidPtr, frow);
+ Dprintf1("RECON: BUFREADY EVENT: col %d\n", event->col);
+ retcode = IssueNextWriteRequest(raidPtr);
#if RF_DEBUG_RECON
if (rf_floatingRbufDebug) {
rf_CheckFloatingRbufCount(raidPtr, 1);
@@ -916,8 +897,8 @@ ProcessReconEvent(raidPtr, frow, event)
/* we need to skip the current RU entirely because it got
* recon'd while we were waiting for something else to happen */
case RF_REVENT_SKIP:
- DDprintf2("RECON: SKIP EVENT: row %d col %d\n", frow, event->col);
- retcode = IssueNextReadRequest(raidPtr, frow, event->col);
+ DDprintf1("RECON: SKIP EVENT: col %d\n", event->col);
+ retcode = IssueNextReadRequest(raidPtr, event->col);
break;
/* a forced-reconstruction read access has completed. Just
@@ -925,7 +906,7 @@ ProcessReconEvent(raidPtr, frow, event)
case RF_REVENT_FORCEDREADDONE:
rbuf = (RF_ReconBuffer_t *) event->arg;
rf_FreeDiskQueueData((RF_DiskQueueData_t *) rbuf->arg);
- DDprintf2("RECON: FORCEDREADDONE EVENT: row %d col %d\n", frow, event->col);
+ DDprintf1("RECON: FORCEDREADDONE EVENT: col %d\n", event->col);
submitblocked = rf_SubmitReconBuffer(rbuf, 1, 0);
RF_ASSERT(!submitblocked);
break;
@@ -958,12 +939,11 @@ ProcessReconEvent(raidPtr, frow, event)
*
*****************************************************************************/
static int
-IssueNextReadRequest(raidPtr, row, col)
+IssueNextReadRequest(raidPtr, col)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
{
- RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl[row]->perDiskInfo[col];
+ RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl->perDiskInfo[col];
RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
RF_ReconBuffer_t *rbuf = ctrl->rbuf;
RF_ReconUnitCount_t RUsPerPU = layoutPtr->SUsPerPU / layoutPtr->SUsPerRU;
@@ -972,7 +952,7 @@ IssueNextReadRequest(raidPtr, row, col)
/* if we are currently the slowest disk, mark that we have to do a new
* check */
- if (ctrl->headSepCounter <= raidPtr->reconControl[row]->minHeadSepCounter)
+ if (ctrl->headSepCounter <= raidPtr->reconControl->minHeadSepCounter)
do_new_check = 1;
while (1) {
@@ -986,16 +966,16 @@ IssueNextReadRequest(raidPtr, row, col)
ctrl->ru_count = 0;
/* code left over from when head-sep was based on
* parity stripe id */
- if (ctrl->curPSID >= raidPtr->reconControl[row]->lastPSID) {
- CheckForNewMinHeadSep(raidPtr, row, ++(ctrl->headSepCounter));
+ if (ctrl->curPSID >= raidPtr->reconControl->lastPSID) {
+ CheckForNewMinHeadSep(raidPtr, ++(ctrl->headSepCounter));
return (1); /* finito! */
}
/* find the disk offsets of the start of the parity
* stripe on both the current disk and the failed
* disk. skip this entire parity stripe if either disk
* does not appear in the indicated PS */
- status = ComputePSDiskOffsets(raidPtr, ctrl->curPSID, row, col, &ctrl->diskOffset, &rbuf->failedDiskSectorOffset,
- &rbuf->spRow, &rbuf->spCol, &rbuf->spOffset);
+ status = ComputePSDiskOffsets(raidPtr, ctrl->curPSID, col, &ctrl->diskOffset, &rbuf->failedDiskSectorOffset,
+ &rbuf->spCol, &rbuf->spOffset);
if (status) {
ctrl->ru_count = RUsPerPU - 1;
continue;
@@ -1004,7 +984,7 @@ IssueNextReadRequest(raidPtr, row, col)
rbuf->which_ru = ctrl->ru_count;
/* skip this RU if it's already been reconstructed */
- if (rf_CheckRUReconstructed(raidPtr->reconControl[row]->reconMap, rbuf->failedDiskSectorOffset)) {
+ if (rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, rbuf->failedDiskSectorOffset)) {
Dprintf2("Skipping psid %ld ru %d: already reconstructed\n", ctrl->curPSID, ctrl->ru_count);
continue;
}
@@ -1012,7 +992,7 @@ IssueNextReadRequest(raidPtr, row, col)
}
ctrl->headSepCounter++;
if (do_new_check)
- CheckForNewMinHeadSep(raidPtr, row, ctrl->headSepCounter); /* update min if needed */
+ CheckForNewMinHeadSep(raidPtr, ctrl->headSepCounter); /* update min if needed */
/* at this point, we have definitely decided what to do, and we have
@@ -1023,7 +1003,7 @@ IssueNextReadRequest(raidPtr, row, col)
sizeof(raidPtr->recon_tracerecs[col]));
raidPtr->recon_tracerecs[col].reconacc = 1;
RF_ETIMER_START(raidPtr->recon_tracerecs[col].recon_timer);
- retcode = TryToRead(raidPtr, row, col);
+ retcode = TryToRead(raidPtr, col);
return (retcode);
}
@@ -1037,12 +1017,11 @@ IssueNextReadRequest(raidPtr, row, col)
*/
static int
-TryToRead(raidPtr, row, col)
+TryToRead(raidPtr, col)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_RowCol_t col;
{
- RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl[row]->perDiskInfo[col];
+ RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl->perDiskInfo[col];
RF_SectorCount_t sectorsPerRU = raidPtr->Layout.sectorsPerStripeUnit * raidPtr->Layout.SUsPerRU;
RF_StripeNum_t psid = ctrl->curPSID;
RF_ReconUnitNum_t which_ru = ctrl->ru_count;
@@ -1052,21 +1031,21 @@ TryToRead(raidPtr, row, col)
/* if the current disk is too far ahead of the others, issue a
* head-separation wait and return */
- if (CheckHeadSeparation(raidPtr, ctrl, row, col, ctrl->headSepCounter, which_ru))
+ if (CheckHeadSeparation(raidPtr, ctrl, col, ctrl->headSepCounter, which_ru))
return (0);
- RF_LOCK_PSS_MUTEX(raidPtr, row, psid);
- pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl[row]->pssTable, psid, which_ru, RF_PSS_CREATE, &created);
+ RF_LOCK_PSS_MUTEX(raidPtr, psid);
+ pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl->pssTable, psid, which_ru, RF_PSS_CREATE, &created);
/* if recon is blocked on the indicated parity stripe, issue a
* block-wait request and return. this also must mark the indicated RU
* in the stripe as under reconstruction if not blocked. */
- status = CheckForcedOrBlockedReconstruction(raidPtr, pssPtr, ctrl, row, col, psid, which_ru);
+ status = CheckForcedOrBlockedReconstruction(raidPtr, pssPtr, ctrl, col, psid, which_ru);
if (status == RF_PSS_RECON_BLOCKED) {
Dprintf2("RECON: Stalling psid %ld ru %d: recon blocked\n", psid, which_ru);
goto out;
} else
if (status == RF_PSS_FORCED_ON_WRITE) {
- rf_CauseReconEvent(raidPtr, row, col, NULL, RF_REVENT_SKIP);
+ rf_CauseReconEvent(raidPtr, col, NULL, RF_REVENT_SKIP);
goto out;
}
/* make one last check to be sure that the indicated RU didn't get
@@ -1076,16 +1055,16 @@ TryToRead(raidPtr, row, col)
* this so that we only do this check if we've definitely blocked on
* one of the above checks. When this condition is detected, we may
* have just created a bogus status entry, which we need to delete. */
- if (rf_CheckRUReconstructed(raidPtr->reconControl[row]->reconMap, ctrl->rbuf->failedDiskSectorOffset)) {
+ if (rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, ctrl->rbuf->failedDiskSectorOffset)) {
Dprintf2("RECON: Skipping psid %ld ru %d: prior recon after stall\n", psid, which_ru);
if (created)
- rf_PSStatusDelete(raidPtr, raidPtr->reconControl[row]->pssTable, pssPtr);
- rf_CauseReconEvent(raidPtr, row, col, NULL, RF_REVENT_SKIP);
+ rf_PSStatusDelete(raidPtr, raidPtr->reconControl->pssTable, pssPtr);
+ rf_CauseReconEvent(raidPtr, col, NULL, RF_REVENT_SKIP);
goto out;
}
/* found something to read. issue the I/O */
- Dprintf5("RECON: Read for psid %ld on row %d col %d offset %ld buf %lx\n",
- psid, row, col, ctrl->diskOffset, ctrl->rbuf->buffer);
+ Dprintf4("RECON: Read for psid %ld on col %d offset %ld buf %lx\n",
+ psid, col, ctrl->diskOffset, ctrl->rbuf->buffer);
RF_ETIMER_STOP(raidPtr->recon_tracerecs[col].recon_timer);
RF_ETIMER_EVAL(raidPtr->recon_tracerecs[col].recon_timer);
raidPtr->recon_tracerecs[col].specific.recon.recon_start_to_fetch_us =
@@ -1100,11 +1079,11 @@ TryToRead(raidPtr, row, col)
RF_ASSERT(req); /* XXX -- fix this -- XXX */
ctrl->rbuf->arg = (void *) req;
- rf_DiskIOEnqueue(&raidPtr->Queues[row][col], req, RF_IO_RECON_PRIORITY);
+ rf_DiskIOEnqueue(&raidPtr->Queues[col], req, RF_IO_RECON_PRIORITY);
pssPtr->issued[col] = 1;
out:
- RF_UNLOCK_PSS_MUTEX(raidPtr, row, psid);
+ RF_UNLOCK_PSS_MUTEX(raidPtr, psid);
return (0);
}
@@ -1138,36 +1117,31 @@ static int
ComputePSDiskOffsets(
RF_Raid_t * raidPtr, /* raid descriptor */
RF_StripeNum_t psid, /* parity stripe identifier */
- RF_RowCol_t row, /* row and column of disk to find the offsets
- * for */
- RF_RowCol_t col,
+ RF_RowCol_t col, /* column of disk to find the offsets for */
RF_SectorNum_t * outDiskOffset,
RF_SectorNum_t * outFailedDiskSectorOffset,
- RF_RowCol_t * spRow, /* OUT: row,col of spare unit for failed unit */
- RF_RowCol_t * spCol,
+ RF_RowCol_t * spCol, /* OUT: col of spare unit for failed unit */
RF_SectorNum_t * spOffset)
{ /* OUT: offset into disk containing spare unit */
RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
- RF_RowCol_t fcol = raidPtr->reconControl[row]->fcol;
+ RF_RowCol_t fcol = raidPtr->reconControl->fcol;
RF_RaidAddr_t sosRaidAddress; /* start-of-stripe */
RF_RowCol_t *diskids;
u_int i, j, k, i_offset, j_offset;
- RF_RowCol_t prow, pcol;
- int testcol, testrow;
- RF_RowCol_t stripe;
+ RF_RowCol_t pcol;
+ int testcol;
RF_SectorNum_t poffset;
char i_is_parity = 0, j_is_parity = 0;
RF_RowCol_t stripeWidth = layoutPtr->numDataCol + layoutPtr->numParityCol;
/* get a listing of the disks comprising that stripe */
sosRaidAddress = rf_ParityStripeIDToRaidAddress(layoutPtr, psid);
- (layoutPtr->map->IdentifyStripe) (raidPtr, sosRaidAddress, &diskids, &stripe);
+ (layoutPtr->map->IdentifyStripe) (raidPtr, sosRaidAddress, &diskids);
RF_ASSERT(diskids);
/* reject this entire parity stripe if it does not contain the
* indicated disk or it does not contain the failed disk */
- if (row != stripe)
- goto skipit;
+
for (i = 0; i < stripeWidth; i++) {
if (col == diskids[i])
break;
@@ -1182,7 +1156,7 @@ ComputePSDiskOffsets(
goto skipit;
}
/* find out which disk the parity is on */
- (layoutPtr->map->MapParity) (raidPtr, sosRaidAddress, &prow, &pcol, &poffset, RF_DONT_REMAP);
+ (layoutPtr->map->MapParity) (raidPtr, sosRaidAddress, &pcol, &poffset, RF_DONT_REMAP);
/* find out if either the current RU or the failed RU is parity */
/* also, if the parity occurs in this stripe prior to the data and/or
@@ -1215,50 +1189,48 @@ ComputePSDiskOffsets(
/* call the mapping routine to get the offset into the current disk,
* repeat for failed disk. */
if (i_is_parity)
- layoutPtr->map->MapParity(raidPtr, sosRaidAddress + i_offset * layoutPtr->sectorsPerStripeUnit, &testrow, &testcol, outDiskOffset, RF_DONT_REMAP);
+ layoutPtr->map->MapParity(raidPtr, sosRaidAddress + i_offset * layoutPtr->sectorsPerStripeUnit, &testcol, outDiskOffset, RF_DONT_REMAP);
else
- layoutPtr->map->MapSector(raidPtr, sosRaidAddress + i_offset * layoutPtr->sectorsPerStripeUnit, &testrow, &testcol, outDiskOffset, RF_DONT_REMAP);
+ layoutPtr->map->MapSector(raidPtr, sosRaidAddress + i_offset * layoutPtr->sectorsPerStripeUnit, &testcol, outDiskOffset, RF_DONT_REMAP);
- RF_ASSERT(row == testrow && col == testcol);
+ RF_ASSERT(col == testcol);
if (j_is_parity)
- layoutPtr->map->MapParity(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, &testrow, &testcol, outFailedDiskSectorOffset, RF_DONT_REMAP);
+ layoutPtr->map->MapParity(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, &testcol, outFailedDiskSectorOffset, RF_DONT_REMAP);
else
- layoutPtr->map->MapSector(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, &testrow, &testcol, outFailedDiskSectorOffset, RF_DONT_REMAP);
- RF_ASSERT(row == testrow && fcol == testcol);
+ layoutPtr->map->MapSector(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, &testcol, outFailedDiskSectorOffset, RF_DONT_REMAP);
+ RF_ASSERT(fcol == testcol);
/* now locate the spare unit for the failed unit */
if (layoutPtr->map->flags & RF_DISTRIBUTE_SPARE) {
if (j_is_parity)
- layoutPtr->map->MapParity(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, spRow, spCol, spOffset, RF_REMAP);
+ layoutPtr->map->MapParity(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, spCol, spOffset, RF_REMAP);
else
- layoutPtr->map->MapSector(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, spRow, spCol, spOffset, RF_REMAP);
+ layoutPtr->map->MapSector(raidPtr, sosRaidAddress + j_offset * layoutPtr->sectorsPerStripeUnit, spCol, spOffset, RF_REMAP);
} else {
- *spRow = raidPtr->reconControl[row]->spareRow;
- *spCol = raidPtr->reconControl[row]->spareCol;
+ *spCol = raidPtr->reconControl->spareCol;
*spOffset = *outFailedDiskSectorOffset;
}
return (0);
skipit:
- Dprintf3("RECON: Skipping psid %ld: nothing needed from r%d c%d\n",
- psid, row, col);
+ Dprintf2("RECON: Skipping psid %ld: nothing needed from r%d c%d\n",
+ psid, col);
return (1);
}
/* this is called when a buffer has become ready to write to the replacement disk */
static int
-IssueNextWriteRequest(raidPtr, row)
+IssueNextWriteRequest(raidPtr)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
{
RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
RF_SectorCount_t sectorsPerRU = layoutPtr->sectorsPerStripeUnit * layoutPtr->SUsPerRU;
- RF_RowCol_t fcol = raidPtr->reconControl[row]->fcol;
+ RF_RowCol_t fcol = raidPtr->reconControl->fcol;
RF_ReconBuffer_t *rbuf;
RF_DiskQueueData_t *req;
- rbuf = rf_GetFullReconBuffer(raidPtr->reconControl[row]);
+ rbuf = rf_GetFullReconBuffer(raidPtr->reconControl);
RF_ASSERT(rbuf); /* there must be one available, or we wouldn't
* have gotten the event that sent us here */
RF_ASSERT(rbuf->pssPtr);
@@ -1266,8 +1238,8 @@ IssueNextWriteRequest(raidPtr, row)
rbuf->pssPtr->writeRbuf = rbuf;
rbuf->pssPtr = NULL;
- Dprintf7("RECON: New write (r %d c %d offs %d) for psid %ld ru %d (failed disk offset %ld) buf %lx\n",
- rbuf->spRow, rbuf->spCol, rbuf->spOffset, rbuf->parityStripeID,
+ Dprintf6("RECON: New write (c %d offs %d) for psid %ld ru %d (failed disk offset %ld) buf %lx\n",
+ rbuf->spCol, rbuf->spOffset, rbuf->parityStripeID,
rbuf->which_ru, rbuf->failedDiskSectorOffset, rbuf->buffer);
Dprintf6("RECON: new write psid %ld %02x %02x %02x %02x %02x\n",
rbuf->parityStripeID, rbuf->buffer[0] & 0xff, rbuf->buffer[1] & 0xff,
@@ -1285,7 +1257,7 @@ IssueNextWriteRequest(raidPtr, row)
RF_ASSERT(req); /* XXX -- fix this -- XXX */
rbuf->arg = (void *) req;
- rf_DiskIOEnqueue(&raidPtr->Queues[rbuf->spRow][rbuf->spCol], req, RF_IO_RECON_PRIORITY);
+ rf_DiskIOEnqueue(&raidPtr->Queues[rbuf->spCol], req, RF_IO_RECON_PRIORITY);
return (0);
}
@@ -1319,7 +1291,7 @@ ReconReadDoneProc(arg, status)
RF_ETIMER_VAL_US(raidPtr->recon_tracerecs[ctrl->col].recon_timer);
RF_ETIMER_START(raidPtr->recon_tracerecs[ctrl->col].recon_timer);
- rf_CauseReconEvent(raidPtr, ctrl->row, ctrl->col, NULL, RF_REVENT_READDONE);
+ rf_CauseReconEvent(raidPtr, ctrl->col, NULL, RF_REVENT_READDONE);
return (0);
}
/* this gets called upon the completion of a reconstruction write operation.
@@ -1340,7 +1312,7 @@ ReconWriteDoneProc(arg, status)
* write failed!\n"); */
RF_PANIC();
}
- rf_CauseReconEvent((RF_Raid_t *) rbuf->raidPtr, rbuf->row, rbuf->col, arg, RF_REVENT_WRITEDONE);
+ rf_CauseReconEvent((RF_Raid_t *) rbuf->raidPtr, rbuf->col, arg, RF_REVENT_WRITEDONE);
return (0);
}
@@ -1350,12 +1322,11 @@ ReconWriteDoneProc(arg, status)
* be woken as a result
*/
static void
-CheckForNewMinHeadSep(raidPtr, row, hsCtr)
+CheckForNewMinHeadSep(raidPtr, hsCtr)
RF_Raid_t *raidPtr;
- RF_RowCol_t row;
RF_HeadSepLimit_t hsCtr;
{
- RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl[row];
+ RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl;
RF_HeadSepLimit_t new_min;
RF_RowCol_t i;
RF_CallbackDesc_t *p;
@@ -1381,7 +1352,7 @@ CheckForNewMinHeadSep(raidPtr, row, hsCtr)
p = reconCtrlPtr->headSepCBList;
reconCtrlPtr->headSepCBList = p->next;
p->next = NULL;
- rf_CauseReconEvent(raidPtr, p->row, p->col, NULL, RF_REVENT_HEADSEPCLEAR);
+ rf_CauseReconEvent(raidPtr, p->col, NULL, RF_REVENT_HEADSEPCLEAR);
rf_FreeCallbackDesc(p);
}
@@ -1405,12 +1376,11 @@ static int
CheckHeadSeparation(
RF_Raid_t * raidPtr,
RF_PerDiskReconCtrl_t * ctrl,
- RF_RowCol_t row,
RF_RowCol_t col,
RF_HeadSepLimit_t hsCtr,
RF_ReconUnitNum_t which_ru)
{
- RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl[row];
+ RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl;
RF_CallbackDesc_t *cb, *p, *pt;
int retval = 0;
@@ -1425,15 +1395,14 @@ CheckHeadSeparation(
RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex);
if ((raidPtr->headSepLimit >= 0) &&
((ctrl->headSepCounter - reconCtrlPtr->minHeadSepCounter) > raidPtr->headSepLimit)) {
- Dprintf6("raid%d: RECON: head sep stall: row %d col %d hsCtr %ld minHSCtr %ld limit %ld\n",
- raidPtr->raidid, row, col, ctrl->headSepCounter,
+ Dprintf5("raid%d: RECON: head sep stall: col %d hsCtr %ld minHSCtr %ld limit %ld\n",
+ raidPtr->raidid, col, ctrl->headSepCounter,
reconCtrlPtr->minHeadSepCounter,
raidPtr->headSepLimit);
cb = rf_AllocCallbackDesc();
/* the minHeadSepCounter value we have to get to before we'll
* wake up. build in 20% hysteresis. */
cb->callbackArg.v = (ctrl->headSepCounter - raidPtr->headSepLimit + raidPtr->headSepLimit / 5);
- cb->row = row;
cb->col = col;
cb->next = NULL;
@@ -1472,7 +1441,6 @@ CheckForcedOrBlockedReconstruction(
RF_Raid_t * raidPtr,
RF_ReconParityStripeStatus_t * pssPtr,
RF_PerDiskReconCtrl_t * ctrl,
- RF_RowCol_t row,
RF_RowCol_t col,
RF_StripeNum_t psid,
RF_ReconUnitNum_t which_ru)
@@ -1484,11 +1452,10 @@ CheckForcedOrBlockedReconstruction(
retcode = RF_PSS_FORCED_ON_WRITE;
else
if (pssPtr->flags & RF_PSS_RECON_BLOCKED) {
- Dprintf4("RECON: row %d col %d blocked at psid %ld ru %d\n", row, col, psid, which_ru);
+ Dprintf3("RECON: col %d blocked at psid %ld ru %d\n", col, psid, which_ru);
cb = rf_AllocCallbackDesc(); /* append ourselves to
* the blockage-wait
* list */
- cb->row = row;
cb->col = col;
cb->next = pssPtr->blockWaitList;
pssPtr->blockWaitList = cb;
@@ -1515,8 +1482,6 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
void (*cbFunc) (RF_Raid_t *, void *);
void *cbArg;
{
- RF_RowCol_t row = asmap->physInfo->row; /* which row of the array
- * we're working on */
RF_StripeNum_t stripeID = asmap->stripeID; /* the stripe ID we're
* forcing recon on */
RF_SectorCount_t sectorsPerRU = raidPtr->Layout.sectorsPerStripeUnit * raidPtr->Layout.SUsPerRU; /* num sects in one RU */
@@ -1526,7 +1491,6 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
RF_SectorNum_t offset, fd_offset; /* disk offset, failed-disk
* offset */
RF_RowCol_t *diskids;
- RF_RowCol_t stripe;
RF_ReconUnitNum_t which_ru; /* RU within parity stripe */
RF_RowCol_t fcol, diskno, i;
RF_ReconBuffer_t *new_rbuf; /* ptr to newly allocated rbufs */
@@ -1536,13 +1500,13 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
psid = rf_MapStripeIDToParityStripeID(&raidPtr->Layout, stripeID, &which_ru);
- RF_LOCK_PSS_MUTEX(raidPtr, row, psid);
+ RF_LOCK_PSS_MUTEX(raidPtr, psid);
- pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl[row]->pssTable, psid, which_ru, RF_PSS_CREATE | RF_PSS_RECON_BLOCKED, &created);
+ pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl->pssTable, psid, which_ru, RF_PSS_CREATE | RF_PSS_RECON_BLOCKED, &created);
/* if recon is not ongoing on this PS, just return */
if (!(pssPtr->flags & RF_PSS_UNDER_RECON)) {
- RF_UNLOCK_PSS_MUTEX(raidPtr, row, psid);
+ RF_UNLOCK_PSS_MUTEX(raidPtr, psid);
return (0);
}
/* otherwise, we have to wait for reconstruction to complete on this
@@ -1556,11 +1520,10 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
* forced recon */
pssPtr->flags &= ~RF_PSS_RECON_BLOCKED; /* clear the blockage
* that we just set */
- fcol = raidPtr->reconControl[row]->fcol;
+ fcol = raidPtr->reconControl->fcol;
/* get a listing of the disks comprising the indicated stripe */
- (raidPtr->Layout.map->IdentifyStripe) (raidPtr, asmap->raidAddress, &diskids, &stripe);
- RF_ASSERT(row == stripe);
+ (raidPtr->Layout.map->IdentifyStripe) (raidPtr, asmap->raidAddress, &diskids);
/* For previously issued reads, elevate them to normal
* priority. If the I/O has already completed, it won't be
@@ -1571,13 +1534,13 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
for (i = 0; i < raidPtr->Layout.numDataCol + raidPtr->Layout.numParityCol; i++)
if ((diskno = diskids[i]) != fcol) {
if (pssPtr->issued[diskno]) {
- nPromoted = rf_DiskIOPromote(&raidPtr->Queues[row][diskno], psid, which_ru);
+ nPromoted = rf_DiskIOPromote(&raidPtr->Queues[diskno], psid, which_ru);
if (rf_reconDebug && nPromoted)
- printf("raid%d: promoted read from row %d col %d\n", raidPtr->raidid, row, diskno);
+ printf("raid%d: promoted read from col %d\n", raidPtr->raidid, diskno);
} else {
- new_rbuf = rf_MakeReconBuffer(raidPtr, row, diskno, RF_RBUF_TYPE_FORCED); /* create new buf */
- ComputePSDiskOffsets(raidPtr, psid, row, diskno, &offset, &fd_offset,
- &new_rbuf->spRow, &new_rbuf->spCol, &new_rbuf->spOffset); /* find offsets & spare
+ new_rbuf = rf_MakeReconBuffer(raidPtr, diskno, RF_RBUF_TYPE_FORCED); /* create new buf */
+ ComputePSDiskOffsets(raidPtr, psid, diskno, &offset, &fd_offset,
+ &new_rbuf->spCol, &new_rbuf->spOffset); /* find offsets & spare
* location */
new_rbuf->parityStripeID = psid; /* fill in the buffer */
new_rbuf->which_ru = which_ru;
@@ -1594,15 +1557,15 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
* XXX */
new_rbuf->arg = req;
- rf_DiskIOEnqueue(&raidPtr->Queues[row][diskno], req, RF_IO_NORMAL_PRIORITY); /* enqueue the I/O */
- Dprintf3("raid%d: Issued new read req on row %d col %d\n", raidPtr->raidid, row, diskno);
+ rf_DiskIOEnqueue(&raidPtr->Queues[diskno], req, RF_IO_NORMAL_PRIORITY); /* enqueue the I/O */
+ Dprintf2("raid%d: Issued new read req on col %d\n", raidPtr->raidid, diskno);
}
}
/* if the write is sitting in the disk queue, elevate its
* priority */
- if (rf_DiskIOPromote(&raidPtr->Queues[row][fcol], psid, which_ru))
- printf("raid%d: promoted write to row %d col %d\n",
- raidPtr->raidid, row, fcol);
+ if (rf_DiskIOPromote(&raidPtr->Queues[fcol], psid, which_ru))
+ printf("raid%d: promoted write to col %d\n",
+ raidPtr->raidid, fcol);
}
/* install a callback descriptor to be invoked when recon completes on
* this parity stripe. */
@@ -1616,7 +1579,7 @@ rf_ForceOrBlockRecon(raidPtr, asmap, cbFunc, cbArg)
DDprintf2("raid%d: Waiting for forced recon on psid %ld\n",
raidPtr->raidid, psid);
- RF_UNLOCK_PSS_MUTEX(raidPtr, row, psid);
+ RF_UNLOCK_PSS_MUTEX(raidPtr, psid);
return (1);
}
/* called upon the completion of a forced reconstruction read.
@@ -1636,7 +1599,7 @@ ForceReconReadDoneProc(arg, status)
* failed!\n"); */
RF_PANIC();
}
- rf_CauseReconEvent((RF_Raid_t *) rbuf->raidPtr, rbuf->row, rbuf->col, (void *) rbuf, RF_REVENT_FORCEDREADDONE);
+ rf_CauseReconEvent((RF_Raid_t *) rbuf->raidPtr, rbuf->col, (void *) rbuf, RF_REVENT_FORCEDREADDONE);
}
/* releases a block on the reconstruction of the indicated stripe */
int
@@ -1644,7 +1607,6 @@ rf_UnblockRecon(raidPtr, asmap)
RF_Raid_t *raidPtr;
RF_AccessStripeMap_t *asmap;
{
- RF_RowCol_t row = asmap->origRow;
RF_StripeNum_t stripeID = asmap->stripeID;
RF_ReconParityStripeStatus_t *pssPtr;
RF_ReconUnitNum_t which_ru;
@@ -1653,8 +1615,8 @@ rf_UnblockRecon(raidPtr, asmap)
RF_CallbackDesc_t *cb;
psid = rf_MapStripeIDToParityStripeID(&raidPtr->Layout, stripeID, &which_ru);
- RF_LOCK_PSS_MUTEX(raidPtr, row, psid);
- pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl[row]->pssTable, psid, which_ru, RF_PSS_NONE, &created);
+ RF_LOCK_PSS_MUTEX(raidPtr, psid);
+ pssPtr = rf_LookupRUStatus(raidPtr, raidPtr->reconControl->pssTable, psid, which_ru, RF_PSS_NONE, &created);
/* When recon is forced, the pss desc can get deleted before we get
* back to unblock recon. But, this can _only_ happen when recon is
@@ -1686,15 +1648,15 @@ rf_UnblockRecon(raidPtr, asmap)
cb = pssPtr->blockWaitList;
pssPtr->blockWaitList = cb->next;
cb->next = NULL;
- rf_CauseReconEvent(raidPtr, cb->row, cb->col, NULL, RF_REVENT_BLOCKCLEAR);
+ rf_CauseReconEvent(raidPtr, cb->col, NULL, RF_REVENT_BLOCKCLEAR);
rf_FreeCallbackDesc(cb);
}
if (!(pssPtr->flags & RF_PSS_UNDER_RECON)) {
/* if no recon was requested while recon was blocked */
- rf_PSStatusDelete(raidPtr, raidPtr->reconControl[row]->pssTable, pssPtr);
+ rf_PSStatusDelete(raidPtr, raidPtr->reconControl->pssTable, pssPtr);
}
}
out:
- RF_UNLOCK_PSS_MUTEX(raidPtr, row, psid);
+ RF_UNLOCK_PSS_MUTEX(raidPtr, psid);
return (0);
}