diff options
| author | oster <oster@NetBSD.org> | 2003-12-29 02:38:17 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2003-12-29 02:38:17 +0000 |
| commit | 10f077a0fb8ef59202e299d65d807c9e050dd4ff (patch) | |
| tree | 80ffb9b4d4556ea201be9bb5db9565fca716f29f /sys/dev/raidframe | |
| parent | d7035f6c9a4cd7330360127a1a450d97de05817e (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')
50 files changed, 1110 insertions, 1422 deletions
diff --git a/sys/dev/raidframe/raidframevar.h b/sys/dev/raidframe/raidframevar.h index a0e4c9ebe80..54228c27aae 100644 --- a/sys/dev/raidframe/raidframevar.h +++ b/sys/dev/raidframe/raidframevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.4 2003/08/12 10:01:08 dsl Exp $ */ +/* $NetBSD: raidframevar.h,v 1.5 2003/12/29 02:38:17 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -509,24 +509,23 @@ typedef struct RF_LayoutSW_s { /* routine to map RAID sector address -> physical (row, col, offset) */ void (*MapSector) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); /* routine to map RAID sector address -> physical (r,c,o) of parity * unit */ void (*MapParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); /* routine to map RAID sector address -> physical (r,c,o) of Q unit */ void (*MapQ) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); /* routine to identify the disks comprising a stripe */ void (*IdentifyStripe) (RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); /* routine to select a dag */ void (*SelectionFunc) (RF_Raid_t * raidPtr, RF_IoType_t type, diff --git a/sys/dev/raidframe/rf_chaindecluster.c b/sys/dev/raidframe/rf_chaindecluster.c index dd940cef716..c7ca23404b2 100644 --- a/sys/dev/raidframe/rf_chaindecluster.c +++ b/sys/dev/raidframe/rf_chaindecluster.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_chaindecluster.c,v 1.9 2002/09/23 02:40:08 oster Exp $ */ +/* $NetBSD: rf_chaindecluster.c,v 1.10 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.9 2002/09/23 02:40:08 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.10 2003/12/29 02:38:17 oster Exp $"); #include "rf_archs.h" @@ -86,8 +86,6 @@ rf_ConfigureChainDecluster( info->stripeIdentifier[i][1] = (i + 1) % raidPtr->numCol; } - RF_ASSERT(raidPtr->numRow == 1); - /* fill in the remaining layout parameters */ num_used_stripeUnitsPerDisk = layoutPtr->stripeUnitsPerDisk - (layoutPtr->stripeUnitsPerDisk % (2 * raidPtr->numCol - 2)); @@ -131,7 +129,6 @@ void rf_MapSectorChainDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) @@ -142,7 +139,6 @@ rf_MapSectorChainDecluster( RF_StripeNum_t sparing_region_id; int col_before_remap; - *row = 0; sparing_region_id = SUID / info->stripeUnitsPerSparingRegion; index_within_region = SUID % info->stripeUnitsPerSparingRegion; index_within_disk = index_within_region / raidPtr->numCol; @@ -180,7 +176,6 @@ void rf_MapParityChainDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) @@ -191,7 +186,6 @@ rf_MapParityChainDecluster( RF_StripeNum_t sparing_region_id; int col_before_remap; - *row = 0; if (!remap) { *col = SUID % raidPtr->numCol; *col = (*col + 1) % raidPtr->numCol; @@ -223,8 +217,7 @@ void rf_IdentifyStripeChainDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_ChaindeclusterConfigInfo_t *info = (RF_ChaindeclusterConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; RF_StripeNum_t SUID; @@ -232,7 +225,6 @@ rf_IdentifyStripeChainDecluster( SUID = addr / raidPtr->Layout.sectorsPerStripeUnit; col = SUID % raidPtr->numCol; - *outRow = 0; *diskids = info->stripeIdentifier[col]; } @@ -268,7 +260,6 @@ rf_RAIDCDagSelect( #endif { RF_ASSERT(RF_IO_IS_R_OR_W(type)); - RF_ASSERT(raidPtr->numRow == 1); if (asmap->numDataFailed + asmap->numParityFailed > 1) { RF_ERRORMSG("Multiple disks failed in a single group! Aborting I/O operation.\n"); @@ -278,7 +269,7 @@ rf_RAIDCDagSelect( *createFunc = (type == RF_IO_TYPE_READ) ? (RF_VoidFuncPtr) rf_CreateFaultFreeReadDAG : (RF_VoidFuncPtr) rf_CreateRaidOneWriteDAG; if (type == RF_IO_TYPE_READ) { - if ((raidPtr->status[0] == rf_rs_degraded) || (raidPtr->status[0] == rf_rs_reconstructing)) + if ((raidPtr->status == rf_rs_degraded) || (raidPtr->status == rf_rs_reconstructing)) *createFunc = (RF_VoidFuncPtr) rf_CreateRaidCDegradedReadDAG; /* array status is * degraded, implement * workload shifting */ diff --git a/sys/dev/raidframe/rf_chaindecluster.h b/sys/dev/raidframe/rf_chaindecluster.h index f9f58b4f038..6807149a967 100644 --- a/sys/dev/raidframe/rf_chaindecluster.h +++ b/sys/dev/raidframe/rf_chaindecluster.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_chaindecluster.h,v 1.4 2001/01/26 04:14:14 oster Exp $ */ +/* $NetBSD: rf_chaindecluster.h,v 1.5 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -40,13 +40,13 @@ rf_ConfigureChainDecluster(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_ReconUnitCount_t rf_GetNumSpareRUsChainDecluster(RF_Raid_t * raidPtr); void rf_MapSectorChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDChainDecluster(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index 8072028b002..574557266a8 100644 --- a/sys/dev/raidframe/rf_copyback.c +++ b/sys/dev/raidframe/rf_copyback.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.25 2003/06/29 22:30:32 fvdl Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.26 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,7 +38,7 @@ ****************************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.25 2003/06/29 22:30:32 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.26 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -64,8 +64,7 @@ int rf_copyback_in_progress; static int rf_CopybackReadDoneProc(RF_CopybackDesc_t * desc, int status); static int rf_CopybackWriteDoneProc(RF_CopybackDesc_t * desc, int status); static void rf_CopybackOne(RF_CopybackDesc_t * desc, int typ, - RF_RaidAddr_t addr, RF_RowCol_t testRow, - RF_RowCol_t testCol, + RF_RaidAddr_t addr, RF_RowCol_t testCol, RF_SectorNum_t testOffs); static void rf_CopybackComplete(RF_CopybackDesc_t * desc, int status); @@ -90,9 +89,9 @@ rf_CopybackReconstructedData(raidPtr) RF_Raid_t *raidPtr; { RF_ComponentLabel_t c_label; - int done, retcode; + int found, retcode; RF_CopybackDesc_t *desc; - RF_RowCol_t frow, fcol; + RF_RowCol_t fcol; RF_RaidDisk_t *badDisk; char *databuf; @@ -103,51 +102,48 @@ rf_CopybackReconstructedData(raidPtr) int ac; - done = 0; fcol = 0; - for (frow = 0; frow < raidPtr->numRow; frow++) { - for (fcol = 0; fcol < raidPtr->numCol; fcol++) { - if (raidPtr->Disks[frow][fcol].status == rf_ds_dist_spared - || raidPtr->Disks[frow][fcol].status == rf_ds_spared) { - done = 1; - break; - } - } - if (done) + found = 0; + for (fcol = 0; fcol < raidPtr->numCol; fcol++) { + if (raidPtr->Disks[fcol].status == rf_ds_dist_spared + || raidPtr->Disks[fcol].status == rf_ds_spared) { + found = 1; break; + } } - if (frow == raidPtr->numRow) { + if (!found) { printf("raid%d: no disks need copyback\n", raidPtr->raidid); return; } - badDisk = &raidPtr->Disks[frow][fcol]; + + badDisk = &raidPtr->Disks[fcol]; proc = raidPtr->engine_thread; /* This device may have been opened successfully the first time. Close * it before trying to open it again.. */ - if (raidPtr->raid_cinfo[frow][fcol].ci_vp != NULL) { + if (raidPtr->raid_cinfo[fcol].ci_vp != NULL) { printf("Closed the open device: %s\n", - raidPtr->Disks[frow][fcol].devname); - vp = raidPtr->raid_cinfo[frow][fcol].ci_vp; - ac = raidPtr->Disks[frow][fcol].auto_configured; + raidPtr->Disks[fcol].devname); + vp = raidPtr->raid_cinfo[fcol].ci_vp; + ac = raidPtr->Disks[fcol].auto_configured; rf_close_component(raidPtr, vp, ac); - raidPtr->raid_cinfo[frow][fcol].ci_vp = NULL; + raidPtr->raid_cinfo[fcol].ci_vp = NULL; } /* note that this disk was *not* auto_configured (any longer) */ - raidPtr->Disks[frow][fcol].auto_configured = 0; + raidPtr->Disks[fcol].auto_configured = 0; printf("About to (re-)open the device: %s\n", - raidPtr->Disks[frow][fcol].devname); + raidPtr->Disks[fcol].devname); - retcode = raidlookup(raidPtr->Disks[frow][fcol].devname, proc, &vp); + retcode = raidlookup(raidPtr->Disks[fcol].devname, proc, &vp); if (retcode) { printf("raid%d: copyback: raidlookup on device: %s failed: %d!\n", - raidPtr->raidid, raidPtr->Disks[frow][fcol].devname, + raidPtr->raidid, raidPtr->Disks[fcol].devname, retcode); /* XXX the component isn't responding properly... must be @@ -167,21 +163,21 @@ rf_CopybackReconstructedData(raidPtr) if (retcode) { return; } - raidPtr->Disks[frow][fcol].blockSize = dpart.disklab->d_secsize; + raidPtr->Disks[fcol].blockSize = dpart.disklab->d_secsize; - raidPtr->Disks[frow][fcol].numBlocks = dpart.part->p_size - + raidPtr->Disks[fcol].numBlocks = dpart.part->p_size - rf_protectedSectors; - raidPtr->raid_cinfo[frow][fcol].ci_vp = vp; - raidPtr->raid_cinfo[frow][fcol].ci_dev = va.va_rdev; + raidPtr->raid_cinfo[fcol].ci_vp = vp; + raidPtr->raid_cinfo[fcol].ci_dev = va.va_rdev; - raidPtr->Disks[frow][fcol].dev = va.va_rdev; /* XXX or the above? */ + raidPtr->Disks[fcol].dev = va.va_rdev; /* XXX or the above? */ /* 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[frow][fcol].numBlocks = - raidPtr->Disks[frow][fcol].numBlocks * + raidPtr->Disks[fcol].numBlocks = + raidPtr->Disks[fcol].numBlocks * rf_sizePercentage / 100; } @@ -197,9 +193,7 @@ rf_CopybackReconstructedData(raidPtr) RF_Malloc(desc, sizeof(*desc), (RF_CopybackDesc_t *)); desc->raidPtr = raidPtr; desc->status = 0; - desc->frow = frow; desc->fcol = fcol; - desc->spRow = badDisk->spareRow; desc->spCol = badDisk->spareCol; desc->stripeAddr = 0; desc->sectPerSU = raidPtr->Layout.sectorsPerStripeUnit; @@ -213,8 +207,8 @@ rf_CopybackReconstructedData(raidPtr) /* adjust state of the array and of the disks */ RF_LOCK_MUTEX(raidPtr->mutex); - raidPtr->Disks[desc->frow][desc->fcol].status = rf_ds_optimal; - raidPtr->status[desc->frow] = rf_rs_optimal; + raidPtr->Disks[desc->fcol].status = rf_ds_optimal; + raidPtr->status = rf_rs_optimal; rf_copyback_in_progress = 1; /* debug only */ RF_UNLOCK_MUTEX(raidPtr->mutex); @@ -223,18 +217,18 @@ rf_CopybackReconstructedData(raidPtr) /* Data has been restored. Fix up the component label. */ /* Don't actually need the read here.. */ - raidread_component_label( raidPtr->raid_cinfo[frow][fcol].ci_dev, - raidPtr->raid_cinfo[frow][fcol].ci_vp, + raidread_component_label( raidPtr->raid_cinfo[fcol].ci_dev, + raidPtr->raid_cinfo[fcol].ci_vp, &c_label); raid_init_component_label( raidPtr, &c_label ); - c_label.row = frow; + c_label.row = 0; c_label.column = fcol; - c_label.partitionSize = raidPtr->Disks[frow][fcol].partitionSize; + c_label.partitionSize = raidPtr->Disks[fcol].partitionSize; - raidwrite_component_label( raidPtr->raid_cinfo[frow][fcol].ci_dev, - raidPtr->raid_cinfo[frow][fcol].ci_vp, + raidwrite_component_label( raidPtr->raid_cinfo[fcol].ci_dev, + raidPtr->raid_cinfo[fcol].ci_vp, &c_label); rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE); } @@ -251,7 +245,7 @@ rf_ContinueCopyback(desc) RF_SectorNum_t testOffs, stripeAddr; RF_Raid_t *raidPtr = desc->raidPtr; RF_RaidAddr_t addr; - RF_RowCol_t testRow, testCol; + RF_RowCol_t testCol; #if RF_DEBUG_RECON int old_pctg, new_pctg; struct timeval t, diff; @@ -289,10 +283,10 @@ rf_ContinueCopyback(desc) for (done = 0, addr = stripeAddr; addr < stripeAddr + desc->sectPerStripe; addr += desc->sectPerSU) { /* map the SU, disallowing remap to spare space */ - (raidPtr->Layout.map->MapSector) (raidPtr, addr, &testRow, &testCol, &testOffs, RF_DONT_REMAP); + (raidPtr->Layout.map->MapSector) (raidPtr, addr, &testCol, &testOffs, RF_DONT_REMAP); - if (testRow == desc->frow && testCol == desc->fcol) { - rf_CopybackOne(desc, RF_COPYBACK_DATA, addr, testRow, testCol, testOffs); + if (testCol == desc->fcol) { + rf_CopybackOne(desc, RF_COPYBACK_DATA, addr, testCol, testOffs); done = 1; break; } @@ -304,10 +298,10 @@ rf_ContinueCopyback(desc) /* map the parity for this stripe, disallowing remap * to spare space */ - (raidPtr->Layout.map->MapParity) (raidPtr, stripeAddr, &testRow, &testCol, &testOffs, RF_DONT_REMAP); + (raidPtr->Layout.map->MapParity) (raidPtr, stripeAddr, &testCol, &testOffs, RF_DONT_REMAP); - if (testRow == desc->frow && testCol == desc->fcol) { - rf_CopybackOne(desc, RF_COPYBACK_PARITY, stripeAddr, testRow, testCol, testOffs); + if (testCol == desc->fcol) { + rf_CopybackOne(desc, RF_COPYBACK_PARITY, stripeAddr, testCol, testOffs); } } /* check to see if the last read/write pair failed */ @@ -323,26 +317,24 @@ rf_ContinueCopyback(desc) /* copyback one unit */ static void -rf_CopybackOne(desc, typ, addr, testRow, testCol, testOffs) +rf_CopybackOne(desc, typ, addr, testCol, testOffs) RF_CopybackDesc_t *desc; int typ; RF_RaidAddr_t addr; - RF_RowCol_t testRow; RF_RowCol_t testCol; RF_SectorNum_t testOffs; { RF_SectorCount_t sectPerSU = desc->sectPerSU; RF_Raid_t *raidPtr = desc->raidPtr; - RF_RowCol_t spRow = desc->spRow; RF_RowCol_t spCol = desc->spCol; RF_SectorNum_t spOffs; /* find the spare spare location for this SU */ if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) { if (typ == RF_COPYBACK_DATA) - raidPtr->Layout.map->MapSector(raidPtr, addr, &spRow, &spCol, &spOffs, RF_REMAP); + raidPtr->Layout.map->MapSector(raidPtr, addr, &spCol, &spOffs, RF_REMAP); else - raidPtr->Layout.map->MapParity(raidPtr, addr, &spRow, &spCol, &spOffs, RF_REMAP); + raidPtr->Layout.map->MapParity(raidPtr, addr, &spCol, &spOffs, RF_REMAP); } else { spOffs = testOffs; } @@ -356,7 +348,6 @@ rf_CopybackOne(desc, typ, addr, testRow, testCol, testOffs) sectPerSU, desc->databuf, 0L, 0, (int (*) (void *, int)) rf_CopybackWriteDoneProc, desc, NULL, NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL); - desc->frow = testRow; desc->fcol = testCol; /* enqueue the read. the write will go out as part of the callback on @@ -367,7 +358,7 @@ rf_CopybackOne(desc, typ, addr, testRow, testCol, testOffs) RF_LOCK_MUTEX(desc->mcpair->mutex); desc->mcpair->flag = 0; - rf_DiskIOEnqueue(&raidPtr->Queues[spRow][spCol], desc->readreq, RF_IO_NORMAL_PRIORITY); + rf_DiskIOEnqueue(&raidPtr->Queues[spCol], desc->readreq, RF_IO_NORMAL_PRIORITY); while (!desc->mcpair->flag) { RF_WAIT_MCPAIR(desc->mcpair); @@ -390,7 +381,7 @@ rf_CopybackReadDoneProc(desc, status) desc->raidPtr->raidid); (desc->writereq->CompleteFunc) (desc, -100); } else { - rf_DiskIOEnqueue(&(desc->raidPtr->Queues[desc->frow][desc->fcol]), desc->writereq, RF_IO_NORMAL_PRIORITY); + rf_DiskIOEnqueue(&(desc->raidPtr->Queues[desc->fcol]), desc->writereq, RF_IO_NORMAL_PRIORITY); } return (0); } @@ -427,7 +418,7 @@ rf_CopybackComplete(desc, status) RF_ASSERT(raidPtr->Layout.map->parityConfig == 'D'); rf_FreeSpareTable(raidPtr); } else { - raidPtr->Disks[desc->spRow][desc->spCol].status = rf_ds_spare; + raidPtr->Disks[desc->spCol].status = rf_ds_spare; } RF_UNLOCK_MUTEX(raidPtr->mutex); diff --git a/sys/dev/raidframe/rf_dagdegrd.c b/sys/dev/raidframe/rf_dagdegrd.c index 6aab7d184da..e7d67b074a8 100644 --- a/sys/dev/raidframe/rf_dagdegrd.c +++ b/sys/dev/raidframe/rf_dagdegrd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegrd.c,v 1.13 2003/02/09 10:04:32 jdolecek Exp $ */ +/* $NetBSD: rf_dagdegrd.c,v 1.14 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.13 2003/02/09 10:04:32 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.14 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -391,7 +391,6 @@ rf_CreateDegradedReadDAG( } /* make a PDA for the parity unit */ RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); - parityPDA->row = asmap->parityInfo->row; parityPDA->col = asmap->parityInfo->col; parityPDA->startSector = ((asmap->parityInfo->startSector / sectorsPerSU) * sectorsPerSU) + (failedPDA->startSector % sectorsPerSU); @@ -685,7 +684,7 @@ rf_DD_GenerateFailedAccessASMs( fone_end = fone_start + fone->numSector; #define CONS_PDA(if,start,num) \ - pda_p->row = asmap->if->row; pda_p->col = asmap->if->col; \ + pda_p->col = asmap->if->col; \ pda_p->startSector = ((asmap->if->startSector / secPerSU) * secPerSU) + start; \ pda_p->numSector = num; \ pda_p->next = NULL; \ @@ -794,9 +793,9 @@ rf_DD_GenerateFailedAccessASMs( continue; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); /* skip over dead disks */ - if (RF_DEAD_DISK(raidPtr->Disks[pda_p->row][pda_p->col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[pda_p->col].status)) continue; switch (state) { case 1: /* fone */ @@ -817,7 +816,7 @@ rf_DD_GenerateFailedAccessASMs( pda_p++; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); pda_p->numSector = ftwo->numSector; pda_p->raidAddress += ftwo_start; pda_p->startSector += ftwo_start; @@ -843,7 +842,7 @@ rf_DD_GenerateFailedAccessASMs( * access, snip off the begining */ pda_p->numSector = suoff - fone_start; pda_p->raidAddress = sosAddr + (i * secPerSU) + fone_start; - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -853,7 +852,7 @@ rf_DD_GenerateFailedAccessASMs( * failed access, extend */ pda_p->numSector = fone_end - suend; pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */ - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -864,14 +863,14 @@ rf_DD_GenerateFailedAccessASMs( * on */ pda_p->numSector = secPerSU - suend; pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */ - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } else if (suoff > 0) { /* short at front */ pda_p->numSector = suoff; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -885,7 +884,7 @@ rf_DD_GenerateFailedAccessASMs( * begining */ pda_p->numSector = suoff - fone_start; pda_p->raidAddress = sosAddr + (i * secPerSU) + fone_start; - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -895,7 +894,7 @@ rf_DD_GenerateFailedAccessASMs( * of the failed access, extend */ pda_p->numSector = fone_end - suend; pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */ - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -908,7 +907,7 @@ rf_DD_GenerateFailedAccessASMs( * begining */ pda_p->numSector = suoff - ftwo_start; pda_p->raidAddress = sosAddr + (i * secPerSU) + ftwo_start; - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -918,7 +917,7 @@ rf_DD_GenerateFailedAccessASMs( * of the failed access, extend */ pda_p->numSector = ftwo_end - suend; pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */ - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList); pda_p++; } @@ -935,9 +934,9 @@ rf_DD_GenerateFailedAccessASMs( continue; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); /* skip over dead disks */ - if (RF_DEAD_DISK(raidPtr->Disks[pda_p->row][pda_p->col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[pda_p->col].status)) continue; switch (state) { case 1: /* fone */ @@ -958,7 +957,7 @@ rf_DD_GenerateFailedAccessASMs( pda_p++; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); pda_p->numSector = ftwo->numSector; pda_p->raidAddress += ftwo_start; pda_p->startSector += ftwo_start; diff --git a/sys/dev/raidframe/rf_dagdegwr.c b/sys/dev/raidframe/rf_dagdegwr.c index e9fe6859017..d3661c8fa6f 100644 --- a/sys/dev/raidframe/rf_dagdegwr.c +++ b/sys/dev/raidframe/rf_dagdegwr.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegwr.c,v 1.11 2002/08/02 03:42:33 oster Exp $ */ +/* $NetBSD: rf_dagdegwr.c,v 1.12 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.11 2002/08/02 03:42:33 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.12 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -331,7 +331,6 @@ rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, * be avoided. */ RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); - parityPDA->row = asmap->parityInfo->row; parityPDA->col = asmap->parityInfo->col; parityPDA->startSector = ((asmap->parityInfo->startSector / sectorsPerSU) * sectorsPerSU) + (failedPDA->startSector % sectorsPerSU); @@ -354,7 +353,6 @@ rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, { RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); - parityPDA->row = asmap->qInfo->row; parityPDA->col = asmap->qInfo->col; parityPDA->startSector = ((asmap->qInfo->startSector / sectorsPerSU) * sectorsPerSU) + (failedPDA->startSector % sectorsPerSU); @@ -512,7 +510,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, termNode->antType[0] = rf_control; } #define CONS_PDA(if,start,num) \ - pda_p->row = asmap->if->row; pda_p->col = asmap->if->col; \ + pda_p->col = asmap->if->col; \ pda_p->startSector = ((asmap->if->startSector / secPerSU) * secPerSU) + start; \ pda_p->numSector = num; \ pda_p->next = NULL; \ @@ -613,9 +611,9 @@ rf_WriteGenerateFailedAccessASMs( continue; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); /* skip over dead disks */ - if (RF_DEAD_DISK(raidPtr->Disks[pda_p->row][pda_p->col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[pda_p->col].status)) continue; switch (state) { case 1: /* fone */ @@ -636,7 +634,7 @@ rf_WriteGenerateFailedAccessASMs( pda_p++; pda_p->type = RF_PDA_TYPE_DATA; pda_p->raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0); pda_p->numSector = ftwo->numSector; pda_p->raidAddress += ftwo_start; pda_p->startSector += ftwo_start; diff --git a/sys/dev/raidframe/rf_dagfuncs.c b/sys/dev/raidframe/rf_dagfuncs.c index b57469f7f8b..decd28f0075 100644 --- a/sys/dev/raidframe/rf_dagfuncs.c +++ b/sys/dev/raidframe/rf_dagfuncs.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagfuncs.c,v 1.12 2003/10/19 01:44:49 simonb Exp $ */ +/* $NetBSD: rf_dagfuncs.c,v 1.13 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.12 2003/10/19 01:44:49 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.13 2003/12/29 02:38:17 oster Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -283,7 +283,7 @@ rf_DiskReadFuncForThreads(node) unsigned which_ru = RF_EXTRACT_RU(node->params[3].v); RF_DiskQueueDataFlags_t flags = 0; RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_READ : RF_IO_TYPE_NOP; - RF_DiskQueue_t **dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; + RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; void *b_proc = NULL; if (node->dagHdr->bp) @@ -302,7 +302,7 @@ rf_DiskReadFuncForThreads(node) (node->wakeFunc) (node, ENOMEM); } else { node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->row][pda->col]), req, priority); + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } return (0); } @@ -325,7 +325,7 @@ rf_DiskWriteFuncForThreads(node) unsigned which_ru = RF_EXTRACT_RU(node->params[3].v); RF_DiskQueueDataFlags_t flags = 0; RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_WRITE : RF_IO_TYPE_NOP; - RF_DiskQueue_t **dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; + RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; void *b_proc = NULL; if (node->dagHdr->bp) @@ -347,7 +347,7 @@ rf_DiskWriteFuncForThreads(node) (node->wakeFunc) (node, ENOMEM); } else { node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->row][pda->col]), req, priority); + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } return (0); @@ -363,7 +363,7 @@ rf_DiskUndoFunc(node) { RF_DiskQueueData_t *req; RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p; - RF_DiskQueue_t **dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; + RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; req = rf_CreateDiskQueueData(RF_IO_TYPE_NOP, 0L, 0, NULL, 0L, 0, @@ -376,7 +376,7 @@ rf_DiskUndoFunc(node) (node->wakeFunc) (node, ENOMEM); else { node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->row][pda->col]), req, RF_IO_NORMAL_PRIORITY); + rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); } return (0); @@ -390,7 +390,7 @@ rf_DiskUnlockFuncForThreads(node) { RF_DiskQueueData_t *req; RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p; - RF_DiskQueue_t **dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; + RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; req = rf_CreateDiskQueueData(RF_IO_TYPE_NOP, 0L, 0, NULL, 0L, 0, @@ -403,7 +403,7 @@ rf_DiskUnlockFuncForThreads(node) (node->wakeFunc) (node, ENOMEM); else { node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->row][pda->col]), req, RF_IO_NORMAL_PRIORITY); + rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); } return (0); diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c index 22e3cef35ad..692f93ff468 100644 --- a/sys/dev/raidframe/rf_dagutils.c +++ b/sys/dev/raidframe/rf_dagutils.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagutils.c,v 1.20 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_dagutils.c,v 1.21 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.20 2003/02/09 10:04:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.21 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -280,7 +280,7 @@ rf_PrintNodeInfoString(RF_DagNode_t * node) lk = RF_EXTRACT_LOCK_FLAG(node->params[3].v); unlk = RF_EXTRACT_UNLOCK_FLAG(node->params[3].v); RF_ASSERT(!(lk && unlk)); - printf("r %d c %d offs %ld nsect %d buf 0x%lx %s\n", pda->row, pda->col, + printf("c %d offs %ld nsect %d buf 0x%lx %s\n", pda->col, (long) pda->startSector, (int) pda->numSector, (long) bufPtr, (lk) ? "LOCK" : ((unlk) ? "UNLK" : " ")); return; @@ -290,7 +290,7 @@ rf_PrintNodeInfoString(RF_DagNode_t * node) lk = RF_EXTRACT_LOCK_FLAG(node->params[3].v); unlk = RF_EXTRACT_UNLOCK_FLAG(node->params[3].v); RF_ASSERT(!(lk && unlk)); - printf("r %d c %d %s\n", pda->row, pda->col, + printf("c %d %s\n", pda->col, (lk) ? "LOCK" : ((unlk) ? "UNLK" : "nop")); return; } @@ -300,8 +300,8 @@ rf_PrintNodeInfoString(RF_DagNode_t * node) for (i = 0; i < node->numParams - 1; i += 2) { pda = (RF_PhysDiskAddr_t *) node->params[i].p; bufPtr = (RF_PhysDiskAddr_t *) node->params[i + 1].p; - printf(" buf 0x%lx r%d c%d offs %ld nsect %d\n", - (long) bufPtr, pda->row, pda->col, + printf(" buf 0x%lx c%d offs %ld nsect %d\n", + (long) bufPtr, pda->col, (long) pda->startSector, (int) pda->numSector); } return; @@ -311,8 +311,8 @@ rf_PrintNodeInfoString(RF_DagNode_t * node) for (i = 0; i < node->numParams - 1; i += 2) { pda = (RF_PhysDiskAddr_t *) node->params[i].p; bufPtr = (RF_PhysDiskAddr_t *) node->params[i + 1].p; - printf(" r%d c%d offs %ld nsect %d buf 0x%lx\n", - pda->row, pda->col, (long) pda->startSector, + printf(" c%d offs %ld nsect %d buf 0x%lx\n", + pda->col, (long) pda->startSector, (int) pda->numSector, (long) bufPtr); } return; @@ -716,17 +716,15 @@ rf_redirect_asm( RF_AccessStripeMap_t * asmap) { int ds = (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) ? 1 : 0; - int row = asmap->physInfo->row; - int fcol = raidPtr->reconControl[row]->fcol; - int srow = raidPtr->reconControl[row]->spareRow; - int scol = raidPtr->reconControl[row]->spareCol; + int fcol = raidPtr->reconControl->fcol; + int scol = raidPtr->reconControl->spareCol; RF_PhysDiskAddr_t *pda; - RF_ASSERT(raidPtr->status[row] == rf_rs_reconstructing); + RF_ASSERT(raidPtr->status == rf_rs_reconstructing); for (pda = asmap->physInfo; pda; pda = pda->next) { if (pda->col == fcol) { if (rf_dagDebug) { - if (!rf_CheckRUReconstructed(raidPtr->reconControl[row]->reconMap, + if (!rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, pda->startSector)) { RF_PANIC(); } @@ -734,9 +732,8 @@ rf_redirect_asm( /* printf("Remapped data for large write\n"); */ if (ds) { raidPtr->Layout.map->MapSector(raidPtr, pda->raidAddress, - &pda->row, &pda->col, &pda->startSector, RF_REMAP); + &pda->col, &pda->startSector, RF_REMAP); } else { - pda->row = srow; pda->col = scol; } } @@ -744,15 +741,14 @@ rf_redirect_asm( for (pda = asmap->parityInfo; pda; pda = pda->next) { if (pda->col == fcol) { if (rf_dagDebug) { - if (!rf_CheckRUReconstructed(raidPtr->reconControl[row]->reconMap, pda->startSector)) { + if (!rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, pda->startSector)) { RF_PANIC(); } } } if (ds) { - (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP); + (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->col, &pda->startSector, RF_REMAP); } else { - pda->row = srow; pda->col = scol; } } @@ -1072,21 +1068,19 @@ rf_compute_workload_shift( * f = column of failed disk * n = number of disks in array * sd = "shift distance" (number of columns that d is to the right of f) - * row = row of array the access is in * v = numerator of redirection ratio * k = denominator of redirection ratio */ - RF_RowCol_t d, f, sd, row, n; + RF_RowCol_t d, f, sd, n; int k, v, ret, i; - row = pda->row; n = raidPtr->numCol; /* assign column of primary copy to d */ d = pda->col; /* assign column of dead disk to f */ - for (f = 0; ((!RF_DEAD_DISK(raidPtr->Disks[row][f].status)) && (f < n)); f++); + for (f = 0; ((!RF_DEAD_DISK(raidPtr->Disks[f].status)) && (f < n)); f++); RF_ASSERT(f < n); RF_ASSERT(f != d); @@ -1120,8 +1114,8 @@ rf_compute_workload_shift( } #endif - raidPtr->hist_diskreq[row][d]++; - if (raidPtr->hist_diskreq[row][d] > v) { + raidPtr->hist_diskreq[d]++; + if (raidPtr->hist_diskreq[d] > v) { ret = 0; /* do not redirect */ } else { ret = 1; /* redirect */ @@ -1129,12 +1123,12 @@ rf_compute_workload_shift( #if 0 printf("d=%d f=%d sd=%d v=%d k=%d ret=%d h=%d\n", d, f, sd, v, k, ret, - raidPtr->hist_diskreq[row][d]); + raidPtr->hist_diskreq[d]); #endif - if (raidPtr->hist_diskreq[row][d] >= k) { + if (raidPtr->hist_diskreq[d] >= k) { /* reset counter */ - raidPtr->hist_diskreq[row][d] = 0; + raidPtr->hist_diskreq[d] = 0; } return (ret); } @@ -1153,21 +1147,19 @@ void rf_SelectMirrorDiskIdle(RF_DagNode_t * node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->dagHdr->raidPtr; - RF_RowCol_t rowData, colData, rowMirror, colMirror; + RF_RowCol_t colData, colMirror; int dataQueueLength, mirrorQueueLength, usemirror; RF_PhysDiskAddr_t *data_pda = (RF_PhysDiskAddr_t *) node->params[0].p; RF_PhysDiskAddr_t *mirror_pda = (RF_PhysDiskAddr_t *) node->params[4].p; RF_PhysDiskAddr_t *tmp_pda; - RF_RaidDisk_t **disks = raidPtr->Disks; - RF_DiskQueue_t **dqs = raidPtr->Queues, *dataQueue, *mirrorQueue; + RF_RaidDisk_t *disks = raidPtr->Disks; + RF_DiskQueue_t *dqs = raidPtr->Queues, *dataQueue, *mirrorQueue; /* return the [row col] of the disk with the shortest queue */ - rowData = data_pda->row; colData = data_pda->col; - rowMirror = mirror_pda->row; colMirror = mirror_pda->col; - dataQueue = &(dqs[rowData][colData]); - mirrorQueue = &(dqs[rowMirror][colMirror]); + dataQueue = &(dqs[colData]); + mirrorQueue = &(dqs[colMirror]); #ifdef RF_LOCK_QUEUES_TO_READ_LEN RF_LOCK_QUEUE_MUTEX(dataQueue, "SelectMirrorDiskIdle"); @@ -1183,10 +1175,10 @@ rf_SelectMirrorDiskIdle(RF_DagNode_t * node) #endif /* RF_LOCK_QUEUES_TO_READ_LEN */ usemirror = 0; - if (RF_DEAD_DISK(disks[rowMirror][colMirror].status)) { + if (RF_DEAD_DISK(disks[colMirror].status)) { usemirror = 0; } else - if (RF_DEAD_DISK(disks[rowData][colData].status)) { + if (RF_DEAD_DISK(disks[colData].status)) { usemirror = 1; } else if (raidPtr->parity_good == RF_RAID_DIRTY) { @@ -1229,24 +1221,22 @@ void rf_SelectMirrorDiskPartition(RF_DagNode_t * node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->dagHdr->raidPtr; - RF_RowCol_t rowData, colData, rowMirror, colMirror; + RF_RowCol_t colData, colMirror; RF_PhysDiskAddr_t *data_pda = (RF_PhysDiskAddr_t *) node->params[0].p; RF_PhysDiskAddr_t *mirror_pda = (RF_PhysDiskAddr_t *) node->params[4].p; RF_PhysDiskAddr_t *tmp_pda; - RF_RaidDisk_t **disks = raidPtr->Disks; + RF_RaidDisk_t *disks = raidPtr->Disks; int usemirror; /* return the [row col] of the disk with the shortest queue */ - rowData = data_pda->row; colData = data_pda->col; - rowMirror = mirror_pda->row; colMirror = mirror_pda->col; usemirror = 0; - if (RF_DEAD_DISK(disks[rowMirror][colMirror].status)) { + if (RF_DEAD_DISK(disks[colMirror].status)) { usemirror = 0; } else - if (RF_DEAD_DISK(disks[rowData][colData].status)) { + if (RF_DEAD_DISK(disks[colData].status)) { usemirror = 1; } else if (raidPtr->parity_good == RF_RAID_DIRTY) { @@ -1254,7 +1244,7 @@ rf_SelectMirrorDiskPartition(RF_DagNode_t * node) usemirror = 0; } else if (data_pda->startSector < - (disks[rowData][colData].numBlocks / 2)) { + (disks[colData].numBlocks / 2)) { usemirror = 0; } else { usemirror = 1; diff --git a/sys/dev/raidframe/rf_declusterPQ.c b/sys/dev/raidframe/rf_declusterPQ.c index d2d195f945f..a87482955c2 100644 --- a/sys/dev/raidframe/rf_declusterPQ.c +++ b/sys/dev/raidframe/rf_declusterPQ.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_declusterPQ.c,v 1.8 2002/09/23 02:40:08 oster Exp $ */ +/* $NetBSD: rf_declusterPQ.c,v 1.9 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,7 +35,7 @@ *--------------------------------------------------*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.8 2002/09/23 02:40:08 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.9 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -163,7 +163,7 @@ rf_ConfigureDeclusteredPQ( else i = extraPUsPerDisk / info->TableDepthInPUs; - complete_FT_count = raidPtr->numRow * (numCompleteSpareRegionsPerDisk * (info->TablesPerSpareRegion / k) + i / k); + complete_FT_count = /* raidPtr->numRow */ 1 * (numCompleteSpareRegionsPerDisk * (info->TablesPerSpareRegion / k) + i / k); info->FullTableLimitSUID = complete_FT_count * info->SUsPerFullTable; info->ExtraTablesPerDisk = i % k; @@ -173,7 +173,7 @@ rf_ConfigureDeclusteredPQ( info->TotSparePUsPerDisk = totSparePUsPerDisk; layoutPtr->stripeUnitsPerDisk = - ((complete_FT_count / raidPtr->numRow) * info->FullTableDepthInPUs + /* data & parity space */ + ((complete_FT_count / /* raidPtr->numRow*/ 1) * info->FullTableDepthInPUs + /* data & parity space */ info->ExtraTablesPerDisk * info->TableDepthInPUs + totSparePUsPerDisk /* spare space */ ) * layoutPtr->SUsPerPU; @@ -190,7 +190,7 @@ rf_ConfigureDeclusteredPQ( /* compute the number of tables in the last fulltable, which * need not be complete */ complete_FT_count = - ((layoutPtr->stripeUnitsPerDisk / layoutPtr->SUsPerPU) / info->FullTableDepthInPUs) * raidPtr->numRow; + ((layoutPtr->stripeUnitsPerDisk / layoutPtr->SUsPerPU) / info->FullTableDepthInPUs) * /* raidPtr->numRow */ 1; info->FullTableLimitSUID = complete_FT_count * info->SUsPerFullTable; info->ExtraTablesPerDisk = @@ -201,7 +201,7 @@ rf_ConfigureDeclusteredPQ( /* find the disk offset of the stripe unit where the last fulltable * starts */ - numCompleteFullTablesPerDisk = complete_FT_count / raidPtr->numRow; + numCompleteFullTablesPerDisk = complete_FT_count / /* raidPtr->numRow */ 1; diskOffsetOfLastFullTableInSUs = numCompleteFullTablesPerDisk * info->FullTableDepthInPUs * layoutPtr->SUsPerPU; if ((raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { SpareSpaceInSUs = numCompleteSpareRegionsPerDisk * info->SpareSpaceDepthPerRegionInSUs; @@ -253,7 +253,7 @@ rf_ConfigureDeclusteredPQ( /* 5. set up the remaining redundant-but-useful parameters */ - raidPtr->totalSectors = (k * complete_FT_count + raidPtr->numRow * info->ExtraTablesPerDisk) * + raidPtr->totalSectors = (k * complete_FT_count + /* raidPtr->numRow */ 1 * info->ExtraTablesPerDisk) * info->SUsPerTable * layoutPtr->sectorsPerStripeUnit; layoutPtr->numStripe = (raidPtr->totalSectors / layoutPtr->sectorsPerStripeUnit) / (k - 2); @@ -298,8 +298,8 @@ rf_MapSectorDeclusteredPQ( FullTableID = SUID / sus_per_fulltable; /* fulltable ID within array * (across rows) */ - *row = FullTableID % raidPtr->numRow; - FullTableID /= raidPtr->numRow; /* convert to fulltable ID on this + *row = FullTableID % /* raidPtr->numRow */ 1; + FullTableID /= /* raidPtr->numRow */ 1; /* convert to fulltable ID on this * disk */ if ((raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { SpareRegion = FullTableID / info->FullTablesPerSpareRegion; @@ -370,8 +370,8 @@ rf_MapParityDeclusteredPQ( /* compute row & (possibly) spare space exactly as before */ FullTableID = SUID / sus_per_fulltable; - *row = FullTableID % raidPtr->numRow; - FullTableID /= raidPtr->numRow; /* convert to fulltable ID on this + *row = FullTableID % /* raidPtr->numRow */ 1; + FullTableID /= /* raidPtr->numRow */ 1; /* convert to fulltable ID on this * disk */ if ((raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { SpareRegion = FullTableID / info->FullTablesPerSpareRegion; @@ -426,8 +426,8 @@ rf_MapQDeclusteredPQ( /* compute row & (possibly) spare space exactly as before */ FullTableID = SUID / sus_per_fulltable; - *row = FullTableID % raidPtr->numRow; - FullTableID /= raidPtr->numRow; /* convert to fulltable ID on this + *row = FullTableID % /* raidPtr->numRow */ 1; + FullTableID /= /* raidPtr->numRow */ 1; /* convert to fulltable ID on this * disk */ if ((raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { SpareRegion = FullTableID / info->FullTablesPerSpareRegion; @@ -482,7 +482,7 @@ rf_IdentifyStripeDeclusteredPQ( rf_decluster_adjust_params(layoutPtr, &SUID, &sus_per_fulltable, &fulltable_depth, &base_suid); FullTableID = SUID / sus_per_fulltable; /* fulltable ID within array * (across rows) */ - *outRow = FullTableID % raidPtr->numRow; + *outRow = FullTableID % /* raidPtr->numRow */ 1; stripeID = rf_StripeUnitIDToStripeID(layoutPtr, SUID); /* find stripe offset * into array */ tableOffset = (stripeID % info->BlocksPerTable); /* find offset into diff --git a/sys/dev/raidframe/rf_desc.h b/sys/dev/raidframe/rf_desc.h index 84b3f220945..258c31e0406 100644 --- a/sys/dev/raidframe/rf_desc.h +++ b/sys/dev/raidframe/rf_desc.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_desc.h,v 1.7 2002/09/15 19:25:07 oster Exp $ */ +/* $NetBSD: rf_desc.h,v 1.8 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,6 @@ struct RF_RaidReconDesc_s { RF_Raid_t *raidPtr; /* raid device descriptor */ - RF_RowCol_t row; /* row of failed disk */ RF_RowCol_t col; /* col of failed disk */ int state; /* how far along the reconstruction operation * has gotten */ @@ -45,8 +44,6 @@ struct RF_RaidReconDesc_s { * (not used in dist sparing) */ int numDisksDone; /* the number of surviving disks that have * completed their work */ - RF_RowCol_t srow; /* row ID of the spare disk (not used in dist - * sparing) */ RF_RowCol_t scol; /* col ID of the spare disk (not used in dist * sparing) */ /* diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c index a533435d28c..a3b49f0030a 100644 --- a/sys/dev/raidframe/rf_diskqueue.c +++ b/sys/dev/raidframe/rf_diskqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.22 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.23 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ ****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.22 2003/02/09 10:04:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.23 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -185,8 +185,6 @@ int rf_ConfigureDiskQueue( RF_Raid_t * raidPtr, RF_DiskQueue_t * diskqueue, - RF_RowCol_t r, /* row & col -- debug only. BZZT not any - * more... */ RF_RowCol_t c, const RF_DiskQueueSW_t * p, RF_SectorCount_t sectPerDisk, @@ -197,7 +195,6 @@ rf_ConfigureDiskQueue( { int rc; - diskqueue->row = r; diskqueue->col = c; diskqueue->qPtr = p; diskqueue->qHdr = (p->Create) (sectPerDisk, clList, listp); @@ -210,7 +207,7 @@ rf_ConfigureDiskQueue( diskqueue->numWaiting = 0; diskqueue->flags = 0; diskqueue->raidPtr = raidPtr; - diskqueue->rf_cinfo = &raidPtr->raid_cinfo[r][c]; + diskqueue->rf_cinfo = &raidPtr->raid_cinfo[c]; rc = rf_create_managed_mutex(listp, &diskqueue->mutex); if (rc) { rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc); @@ -258,9 +255,9 @@ rf_ConfigureDiskQueues( RF_Raid_t * raidPtr, RF_Config_t * cfgPtr) { - RF_DiskQueue_t **diskQueues, *spareQueues; + RF_DiskQueue_t *diskQueues, *spareQueues; const RF_DiskQueueSW_t *p; - RF_RowCol_t r, c; + RF_RowCol_t r,c; int rc, i; raidPtr->maxQueueDepth = cfgPtr->maxOutstandingDiskReqs; @@ -276,38 +273,33 @@ rf_ConfigureDiskQueues( p = &diskqueuesw[0]; } raidPtr->qType = p; - RF_CallocAndAdd(diskQueues, raidPtr->numRow, sizeof(RF_DiskQueue_t *), (RF_DiskQueue_t **), raidPtr->cleanupList); - if (diskQueues == NULL) { + + RF_CallocAndAdd(diskQueues, raidPtr->numCol + RF_MAXSPARE, + sizeof(RF_DiskQueue_t), (RF_DiskQueue_t *), + raidPtr->cleanupList); + if (diskQueues == NULL) return (ENOMEM); - } raidPtr->Queues = diskQueues; - for (r = 0; r < raidPtr->numRow; r++) { - RF_CallocAndAdd(diskQueues[r], raidPtr->numCol + - ((r == 0) ? RF_MAXSPARE : 0), - sizeof(RF_DiskQueue_t), (RF_DiskQueue_t *), - raidPtr->cleanupList); - if (diskQueues[r] == NULL) - return (ENOMEM); - for (c = 0; c < raidPtr->numCol; c++) { - rc = rf_ConfigureDiskQueue(raidPtr, &diskQueues[r][c], - r, c, p, - raidPtr->sectorsPerDisk, - raidPtr->Disks[r][c].dev, - cfgPtr->maxOutstandingDiskReqs, - listp, raidPtr->cleanupList); - if (rc) - return (rc); - } + + for (c = 0; c < raidPtr->numCol; c++) { + rc = rf_ConfigureDiskQueue(raidPtr, &diskQueues[c], + c, p, + raidPtr->sectorsPerDisk, + raidPtr->Disks[c].dev, + cfgPtr->maxOutstandingDiskReqs, + listp, raidPtr->cleanupList); + if (rc) + return (rc); } - spareQueues = &raidPtr->Queues[0][raidPtr->numCol]; + spareQueues = &raidPtr->Queues[raidPtr->numCol]; for (r = 0; r < raidPtr->numSpare; r++) { rc = rf_ConfigureDiskQueue(raidPtr, &spareQueues[r], - 0, raidPtr->numCol + r, p, - raidPtr->sectorsPerDisk, - raidPtr->Disks[0][raidPtr->numCol + r].dev, - cfgPtr->maxOutstandingDiskReqs, listp, - raidPtr->cleanupList); + raidPtr->numCol + r, p, + raidPtr->sectorsPerDisk, + raidPtr->Disks[raidPtr->numCol + r].dev, + cfgPtr->maxOutstandingDiskReqs, listp, + raidPtr->cleanupList); if (rc) return (rc); } @@ -364,14 +356,14 @@ rf_DiskIOEnqueue(queue, req, pri) /* locking request */ if (RF_LOCKING_REQ(req)) { if (RF_QUEUE_EMPTY(queue)) { - Dprintf3("Dispatching pri %d locking op to r %d c %d (queue empty)\n", pri, queue->row, queue->col); + Dprintf2("Dispatching pri %d locking op to c %d (queue empty)\n", pri, queue->col); RF_LOCK_QUEUE(queue); rf_DispatchKernelIO(queue, req); } else { queue->queueLength++; /* increment count of number * of requests waiting in this * queue */ - Dprintf3("Enqueueing pri %d locking op to r %d c %d (queue not empty)\n", pri, queue->row, queue->col); + Dprintf2("Enqueueing pri %d locking op to c %d (queue not empty)\n", pri, queue->col); req->queue = (void *) queue; (queue->qPtr->Enqueue) (queue->qHdr, req, pri); } @@ -380,20 +372,20 @@ rf_DiskIOEnqueue(queue, req, pri) else if (RF_UNLOCKING_REQ(req)) { /* we'll do the actual unlock * when this I/O completes */ - Dprintf3("Dispatching pri %d unlocking op to r %d c %d\n", pri, queue->row, queue->col); + Dprintf2("Dispatching pri %d unlocking op to c %d\n", pri, queue->col); RF_ASSERT(RF_QUEUE_LOCKED(queue)); rf_DispatchKernelIO(queue, req); } /* normal request */ else if (RF_OK_TO_DISPATCH(queue, req)) { - Dprintf3("Dispatching pri %d regular op to r %d c %d (ok to dispatch)\n", pri, queue->row, queue->col); + Dprintf2("Dispatching pri %d regular op to c %d (ok to dispatch)\n", pri, queue->col); rf_DispatchKernelIO(queue, req); } else { queue->queueLength++; /* increment count of * number of requests * waiting in this queue */ - Dprintf3("Enqueueing pri %d regular op to r %d c %d (not ok to dispatch)\n", pri, queue->row, queue->col); + Dprintf2("Enqueueing pri %d regular op to c %d (not ok to dispatch)\n", pri, queue->col); req->queue = (void *) queue; (queue->qPtr->Enqueue) (queue->qHdr, req, pri); } @@ -415,7 +407,7 @@ rf_DiskIOComplete(queue, req, status) /* unlock the queue: (1) after an unlocking req completes (2) after a * locking req fails */ if (RF_UNLOCKING_REQ(req) || (RF_LOCKING_REQ(req) && status)) { - Dprintf2("DiskIOComplete: unlocking queue at r %d c %d\n", queue->row, queue->col); + Dprintf1("DiskIOComplete: unlocking queue at c %d\n", queue->col); RF_ASSERT(RF_QUEUE_LOCKED(queue)); RF_UNLOCK_QUEUE(queue); } @@ -430,11 +422,11 @@ rf_DiskIOComplete(queue, req, status) if (queue->nextLockingOp) { req = queue->nextLockingOp; queue->nextLockingOp = NULL; - Dprintf3("DiskIOComplete: a pri %d locking req was pending at r %d c %d\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: a pri %d locking req was pending at c %d\n", req->priority, queue->col); } else { req = (queue->qPtr->Dequeue) (queue->qHdr); if (req != NULL) { - Dprintf3("DiskIOComplete: extracting pri %d req from queue at r %d c %d\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: extracting pri %d req from queue at c %d\n", req->priority, queue->col); } else { Dprintf1("DiskIOComplete: no more requests to extract.\n", ""); } @@ -450,13 +442,13 @@ rf_DiskIOComplete(queue, req, status) else if (RF_LOCKING_REQ(req)) { if (RF_QUEUE_EMPTY(queue)) { /* dispatch it */ - Dprintf3("DiskIOComplete: dispatching pri %d locking req to r %d c %d (queue empty)\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: dispatching pri %d locking req to c %d (queue empty)\n", req->priority, queue->col); RF_LOCK_QUEUE(queue); rf_DispatchKernelIO(queue, req); done = 1; } else { /* put it aside to wait for * the queue to drain */ - Dprintf3("DiskIOComplete: postponing pri %d locking req to r %d c %d\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: postponing pri %d locking req to c %d\n", req->priority, queue->col); RF_ASSERT(queue->nextLockingOp == NULL); queue->nextLockingOp = req; done = 1; @@ -467,19 +459,19 @@ rf_DiskIOComplete(queue, req, status) * not get queued */ RF_ASSERT(RF_QUEUE_LOCKED(queue)); /* support it anyway for * the future */ - Dprintf3("DiskIOComplete: dispatching pri %d unl req to r %d c %d (SHOULD NOT SEE THIS)\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: dispatching pri %d unl req to c %d (SHOULD NOT SEE THIS)\n", req->priority, queue->col); rf_DispatchKernelIO(queue, req); done = 1; } else if (RF_OK_TO_DISPATCH(queue, req)) { - Dprintf3("DiskIOComplete: dispatching pri %d regular req to r %d c %d (ok to dispatch)\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: dispatching pri %d regular req to c %d (ok to dispatch)\n", req->priority, queue->col); rf_DispatchKernelIO(queue, req); } else { /* we can't dispatch it, * so just re-enqueue * it. */ /* potential trouble here if * disk queues batch reqs */ - Dprintf3("DiskIOComplete: re-enqueueing pri %d regular req to r %d c %d\n", req->priority, queue->row, queue->col); + Dprintf2("DiskIOComplete: re-enqueueing pri %d regular req to c %d\n", req->priority, queue->col); queue->queueLength++; (queue->qPtr->Enqueue) (queue->qHdr, req, req->priority); done = 1; diff --git a/sys/dev/raidframe/rf_diskqueue.h b/sys/dev/raidframe/rf_diskqueue.h index e14a2ca3fa1..e3ebd6c88fd 100644 --- a/sys/dev/raidframe/rf_diskqueue.h +++ b/sys/dev/raidframe/rf_diskqueue.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.h,v 1.12 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_diskqueue.h,v 1.13 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -182,7 +182,7 @@ void rf_FreeDiskQueueData(RF_DiskQueueData_t * p); int -rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *, RF_RowCol_t, +rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *, RF_RowCol_t, const RF_DiskQueueSW_t *, RF_SectorCount_t, dev_t, int, RF_ShutdownList_t **, diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index b97dc104e9a..c4ede353e08 100644 --- a/sys/dev/raidframe/rf_disks.c +++ b/sys/dev/raidframe/rf_disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.45 2003/10/21 00:22:04 fvdl Exp $ */ +/* $NetBSD: rf_disks.c,v 1.46 2003/12/29 02:38:17 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -67,7 +67,7 @@ ***************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.45 2003/10/21 00:22:04 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.46 2003/12/29 02:38:17 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -87,7 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.45 2003/10/21 00:22:04 fvdl Exp $"); #include <sys/vnode.h> static int rf_AllocDiskStructures(RF_Raid_t *, RF_Config_t *); -static void rf_print_label_status( RF_Raid_t *, int, int, char *, +static void rf_print_label_status( RF_Raid_t *, int, char *, RF_ComponentLabel_t *); static int rf_check_label_vitals( RF_Raid_t *, int, int, char *, RF_ComponentLabel_t *, int, int ); @@ -115,9 +115,9 @@ rf_ConfigureDisks( listp, raidPtr, cfgPtr ) RF_Raid_t *raidPtr; RF_Config_t *cfgPtr; { - RF_RaidDisk_t **disks; + RF_RaidDisk_t *disks; RF_SectorCount_t min_numblks = (RF_SectorCount_t) 0x7FFFFFFFFFFFLL; - RF_RowCol_t r, c; + RF_RowCol_t c; int bs, ret; unsigned i, count, foundone = 0, numFailuresThisRow; int force; @@ -130,52 +130,50 @@ rf_ConfigureDisks( listp, raidPtr, cfgPtr ) disks = raidPtr->Disks; - for (r = 0; r < raidPtr->numRow; r++) { - numFailuresThisRow = 0; - for (c = 0; c < raidPtr->numCol; c++) { - ret = rf_ConfigureDisk(raidPtr, - &cfgPtr->devnames[r][c][0], - &disks[r][c], r, c); - - if (ret) - goto fail; - - if (disks[r][c].status == rf_ds_optimal) { - raidread_component_label( - raidPtr->raid_cinfo[r][c].ci_dev, - raidPtr->raid_cinfo[r][c].ci_vp, - &raidPtr->raid_cinfo[r][c].ci_label); - } + numFailuresThisRow = 0; + for (c = 0; c < raidPtr->numCol; c++) { + ret = rf_ConfigureDisk(raidPtr, + &cfgPtr->devnames[0][c][0], + &disks[c], c); + + if (ret) + goto fail; + + if (disks[c].status == rf_ds_optimal) { + raidread_component_label( + raidPtr->raid_cinfo[c].ci_dev, + raidPtr->raid_cinfo[c].ci_vp, + &raidPtr->raid_cinfo[c].ci_label); + } - if (disks[r][c].status != rf_ds_optimal) { - numFailuresThisRow++; - } else { - if (disks[r][c].numBlocks < min_numblks) - min_numblks = disks[r][c].numBlocks; - DPRINTF7("Disk at row %d col %d: dev %s numBlocks %ld blockSize %d (%ld MB)\n", - r, c, disks[r][c].devname, - (long int) disks[r][c].numBlocks, - disks[r][c].blockSize, - (long int) disks[r][c].numBlocks * - disks[r][c].blockSize / 1024 / 1024); - } + if (disks[c].status != rf_ds_optimal) { + numFailuresThisRow++; + } else { + if (disks[c].numBlocks < min_numblks) + min_numblks = disks[c].numBlocks; + DPRINTF6("Disk at col %d: dev %s numBlocks %ld blockSize %d (%ld MB)\n", + c, disks[c].devname, + (long int) disks[c].numBlocks, + disks[c].blockSize, + (long int) disks[c].numBlocks * + disks[c].blockSize / 1024 / 1024); } - /* XXX fix for n-fault tolerant */ - /* XXX this should probably check to see how many failures - we can handle for this configuration! */ - if (numFailuresThisRow > 0) - raidPtr->status[r] = rf_rs_degraded; } + /* XXX fix for n-fault tolerant */ + /* XXX this should probably check to see how many failures + we can handle for this configuration! */ + if (numFailuresThisRow > 0) + raidPtr->status = rf_rs_degraded; /* all disks must be the same size & have the same block size, bs must * be a power of 2 */ bs = 0; - for (foundone = r = 0; !foundone && r < raidPtr->numRow; r++) { - for (c = 0; !foundone && c < raidPtr->numCol; c++) { - if (disks[r][c].status == rf_ds_optimal) { - bs = disks[r][c].blockSize; - foundone = 1; - } + foundone = 0; + for (c = 0; c < raidPtr->numCol; c++) { + if (disks[c].status == rf_ds_optimal) { + bs = disks[c].blockSize; + foundone = 1; + break; } } if (!foundone) { @@ -203,19 +201,17 @@ rf_ConfigureDisks( listp, raidPtr, cfgPtr ) } } - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - if (disks[r][c].status == rf_ds_optimal) { - if (disks[r][c].blockSize != bs) { - RF_ERRORMSG2("Error: block size of disk at r %d c %d different from disk at r 0 c 0\n", r, c); - ret = EINVAL; - goto fail; - } - if (disks[r][c].numBlocks != min_numblks) { - RF_ERRORMSG3("WARNING: truncating disk at r %d c %d to %d blocks\n", - r, c, (int) min_numblks); - disks[r][c].numBlocks = min_numblks; - } + for (c = 0; c < raidPtr->numCol; c++) { + if (disks[c].status == rf_ds_optimal) { + if (disks[c].blockSize != bs) { + RF_ERRORMSG1("Error: block size of disk at c %d different from disk at c 0\n", c); + ret = EINVAL; + goto fail; + } + if (disks[c].numBlocks != min_numblks) { + RF_ERRORMSG2("WARNING: truncating disk at c %d to %d blocks\n", + c, (int) min_numblks); + disks[c].numBlocks = min_numblks; } } } @@ -255,10 +251,10 @@ rf_ConfigureSpareDisks( listp, raidPtr, cfgPtr ) /* The space for the spares should have already been allocated by * ConfigureDisks() */ - disks = &raidPtr->Disks[0][raidPtr->numCol]; + disks = &raidPtr->Disks[raidPtr->numCol]; for (i = 0; i < raidPtr->numSpare; i++) { ret = rf_ConfigureDisk(raidPtr, &cfgPtr->spare_names[i][0], - &disks[i], 0, raidPtr->numCol + i); + &disks[i], raidPtr->numCol + i); if (ret) goto fail; if (disks[i].status != rf_ds_optimal) { @@ -324,47 +320,28 @@ rf_AllocDiskStructures(raidPtr, cfgPtr) RF_Raid_t *raidPtr; RF_Config_t *cfgPtr; { - RF_RaidDisk_t **disks; int ret; - int r; - RF_CallocAndAdd(disks, raidPtr->numRow, sizeof(RF_RaidDisk_t *), - (RF_RaidDisk_t **), raidPtr->cleanupList); - if (disks == NULL) { + /* We allocate RF_MAXSPARE on the first row so that we + have room to do hot-swapping of spares */ + RF_CallocAndAdd(raidPtr->Disks, raidPtr->numCol + RF_MAXSPARE, + sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *), + raidPtr->cleanupList); + if (raidPtr->Disks == NULL) { ret = ENOMEM; goto fail; } - raidPtr->Disks = disks; - /* get space for the device-specific stuff... */ - RF_CallocAndAdd(raidPtr->raid_cinfo, raidPtr->numRow, - sizeof(struct raidcinfo *), (struct raidcinfo **), - raidPtr->cleanupList); + + /* get space for device specific stuff.. */ + RF_CallocAndAdd(raidPtr->raid_cinfo, + raidPtr->numCol + raidPtr->numSpare, + sizeof(struct raidcinfo), (struct raidcinfo *), + raidPtr->cleanupList); if (raidPtr->raid_cinfo == NULL) { ret = ENOMEM; goto fail; } - for (r = 0; r < raidPtr->numRow; r++) { - /* We allocate RF_MAXSPARE on the first row so that we - have room to do hot-swapping of spares */ - RF_CallocAndAdd(disks[r], raidPtr->numCol - + ((r == 0) ? RF_MAXSPARE : 0), - sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *), - raidPtr->cleanupList); - if (disks[r] == NULL) { - ret = ENOMEM; - goto fail; - } - /* get more space for device specific stuff.. */ - RF_CallocAndAdd(raidPtr->raid_cinfo[r], - raidPtr->numCol + ((r == 0) ? raidPtr->numSpare : 0), - sizeof(struct raidcinfo), (struct raidcinfo *), - raidPtr->cleanupList); - if (raidPtr->raid_cinfo[r] == NULL) { - ret = ENOMEM; - goto fail; - } - } return(0); fail: rf_UnconfigureVnodes( raidPtr ); @@ -380,9 +357,9 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) RF_Config_t *cfgPtr; RF_AutoConfig_t *auto_config; { - RF_RaidDisk_t **disks; + RF_RaidDisk_t *disks; RF_RaidDisk_t *diskPtr; - RF_RowCol_t r, c; + RF_RowCol_t c; RF_SectorCount_t min_numblks = (RF_SectorCount_t) 0x7FFFFFFFFFFFLL; int bs, ret; int numFailuresThisRow; @@ -422,149 +399,142 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) } bs = 0; - for (r = 0; r < raidPtr->numRow; r++) { - numFailuresThisRow = 0; - for (c = 0; c < raidPtr->numCol; c++) { - diskPtr = &disks[r][c]; - /* find this row/col in the autoconfig */ + numFailuresThisRow = 0; + for (c = 0; c < raidPtr->numCol; c++) { + diskPtr = &disks[c]; + + /* find this row/col in the autoconfig */ #if DEBUG - printf("Looking for %d,%d in autoconfig\n",r,c); + printf("Looking for %d in autoconfig\n",c); #endif + ac = auto_config; + while(ac!=NULL) { + if (ac->clabel==NULL) { + /* big-time bad news. */ + goto fail; + } + if ((ac->clabel->column == c) && + (ac->clabel->mod_counter == mod_counter)) { + /* it's this one... */ + /* flag it as 'used', so we don't + free it later. */ + ac->flag = 1; +#if DEBUG + printf("Found: %s at %d\n", + ac->devname,c); +#endif + + break; + } + ac=ac->next; + } + + if (ac==NULL) { + /* we didn't find an exact match with a + correct mod_counter above... can we find + one with an incorrect mod_counter to use + instead? (this one, if we find it, will be + marked as failed once the set configures) + */ + ac = auto_config; while(ac!=NULL) { if (ac->clabel==NULL) { /* big-time bad news. */ goto fail; } - if ((ac->clabel->row == r) && - (ac->clabel->column == c) && - (ac->clabel->mod_counter == mod_counter)) { - /* it's this one... */ - /* flag it as 'used', so we don't - free it later. */ + if (ac->clabel->column == c) { + /* it's this one... + flag it as 'used', so we + don't free it later. */ ac->flag = 1; #if DEBUG - printf("Found: %s at %d,%d\n", - ac->devname,r,c); + printf("Found(low mod_counter): %s at %d\n", + ac->devname,c); #endif break; } ac=ac->next; } - - if (ac==NULL) { - /* we didn't find an exact match with a - correct mod_counter above... can we - find one with an incorrect mod_counter - to use instead? (this one, if we find - it, will be marked as failed once the - set configures) - */ - - ac = auto_config; - while(ac!=NULL) { - if (ac->clabel==NULL) { - /* big-time bad news. */ - goto fail; - } - if ((ac->clabel->row == r) && - (ac->clabel->column == c)) { - /* it's this one... - flag it as 'used', so we - don't free it later. */ - ac->flag = 1; -#if DEBUG - printf("Found(low mod_counter): %s at %d,%d\n", - ac->devname,r,c); -#endif - - break; - } - ac=ac->next; - } - } - + } - if (ac!=NULL) { - /* Found it. Configure it.. */ - diskPtr->blockSize = ac->clabel->blockSize; - diskPtr->numBlocks = ac->clabel->numBlocks; - /* Note: rf_protectedSectors is already - factored into numBlocks here */ - raidPtr->raid_cinfo[r][c].ci_vp = ac->vp; - raidPtr->raid_cinfo[r][c].ci_dev = ac->dev; - memcpy(&raidPtr->raid_cinfo[r][c].ci_label, - ac->clabel, sizeof(*ac->clabel)); - sprintf(diskPtr->devname, "/dev/%s", - ac->devname); + if (ac!=NULL) { + /* Found it. Configure it.. */ + diskPtr->blockSize = ac->clabel->blockSize; + diskPtr->numBlocks = ac->clabel->numBlocks; + /* Note: rf_protectedSectors is already + factored into numBlocks here */ + raidPtr->raid_cinfo[c].ci_vp = ac->vp; + raidPtr->raid_cinfo[c].ci_dev = ac->dev; + + memcpy(&raidPtr->raid_cinfo[c].ci_label, + ac->clabel, sizeof(*ac->clabel)); + sprintf(diskPtr->devname, "/dev/%s", + ac->devname); - /* note the fact that this component was - autoconfigured. You'll need this info - later. Trust me :) */ - diskPtr->auto_configured = 1; - diskPtr->dev = ac->dev; + /* note the fact that this component was + autoconfigured. You'll need this info + later. Trust me :) */ + diskPtr->auto_configured = 1; + diskPtr->dev = ac->dev; - /* - * 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 - */ - - diskPtr->numBlocks = diskPtr->numBlocks * - rf_sizePercentage / 100; - - /* XXX these will get set multiple times, - but since we're autoconfiguring, they'd - better be always the same each time! - If not, this is the least of your worries */ - - bs = diskPtr->blockSize; - min_numblks = diskPtr->numBlocks; - - /* this gets done multiple times, but that's - fine -- the serial number will be the same - for all components, guaranteed */ - raidPtr->serial_number = - ac->clabel->serial_number; - /* check the last time the label - was modified */ - if (ac->clabel->mod_counter != - mod_counter) { - /* Even though we've filled in all - of the above, we don't trust - this component since it's - modification counter is not - in sync with the rest, and we really - consider it to be failed. */ - disks[r][c].status = rf_ds_failed; - numFailuresThisRow++; - } else { - if (ac->clabel->clean != - RF_RAID_CLEAN) { - parity_good = RF_RAID_DIRTY; - } - } - } else { - /* Didn't find it at all!! - Component must really be dead */ - disks[r][c].status = rf_ds_failed; - sprintf(disks[r][c].devname,"component%d", - r * raidPtr->numCol + c); + /* + * 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 + */ + + diskPtr->numBlocks = diskPtr->numBlocks * + rf_sizePercentage / 100; + + /* XXX these will get set multiple times, + but since we're autoconfiguring, they'd + better be always the same each time! + If not, this is the least of your worries */ + + bs = diskPtr->blockSize; + min_numblks = diskPtr->numBlocks; + + /* this gets done multiple times, but that's + fine -- the serial number will be the same + for all components, guaranteed */ + raidPtr->serial_number = ac->clabel->serial_number; + /* check the last time the label was modified */ + + if (ac->clabel->mod_counter != mod_counter) { + /* Even though we've filled in all of + the above, we don't trust this + component since it's modification + counter is not in sync with the + rest, and we really consider it to + be failed. */ + disks[c].status = rf_ds_failed; numFailuresThisRow++; + } else { + if (ac->clabel->clean != RF_RAID_CLEAN) { + parity_good = RF_RAID_DIRTY; + } } + } else { + /* Didn't find it at all!! Component must + really be dead */ + disks[c].status = rf_ds_failed; + sprintf(disks[c].devname,"component%d", + raidPtr->numCol + c); + numFailuresThisRow++; } - /* XXX fix for n-fault tolerant */ - /* XXX this should probably check to see how many failures - we can handle for this configuration! */ - if (numFailuresThisRow > 0) - raidPtr->status[r] = rf_rs_degraded; } - + /* XXX fix for n-fault tolerant */ + /* XXX this should probably check to see how many failures + we can handle for this configuration! */ + if (numFailuresThisRow > 0) + raidPtr->status = rf_rs_degraded; + /* close the device for the ones that didn't get used */ ac = auto_config; @@ -602,11 +572,10 @@ fail: /* configure a single disk in the array */ int -rf_ConfigureDisk(raidPtr, buf, diskPtr, row, col) +rf_ConfigureDisk(raidPtr, buf, diskPtr, col) RF_Raid_t *raidPtr; char *buf; RF_RaidDisk_t *diskPtr; - RF_RowCol_t row; RF_RowCol_t col; { char *p; @@ -628,8 +597,8 @@ rf_ConfigureDisk(raidPtr, buf, diskPtr, row, col) /* Let's start by claiming the component is fine and well... */ diskPtr->status = rf_ds_optimal; - raidPtr->raid_cinfo[row][col].ci_vp = NULL; - raidPtr->raid_cinfo[row][col].ci_dev = 0; + raidPtr->raid_cinfo[col].ci_vp = NULL; + raidPtr->raid_cinfo[col].ci_dev = 0; error = raidlookup(diskPtr->devname, proc, &vp); if (error) { @@ -657,8 +626,8 @@ rf_ConfigureDisk(raidPtr, buf, diskPtr, row, col) diskPtr->numBlocks = dpart.part->p_size - rf_protectedSectors; diskPtr->partitionSize = dpart.part->p_size; - 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; /* This component was not automatically configured */ diskPtr->auto_configured = 0; @@ -674,19 +643,18 @@ rf_ConfigureDisk(raidPtr, buf, diskPtr, row, col) } static void -rf_print_label_status( raidPtr, row, column, dev_name, ci_label ) +rf_print_label_status( raidPtr, column, dev_name, ci_label ) RF_Raid_t *raidPtr; - int row; int column; char *dev_name; RF_ComponentLabel_t *ci_label; { - printf("raid%d: Component %s being configured at row: %d col: %d\n", - raidPtr->raidid, dev_name, row, column ); - printf(" Row: %d Column: %d Num Rows: %d Num Columns: %d\n", - ci_label->row, ci_label->column, - ci_label->num_rows, ci_label->num_columns); + printf("raid%d: Component %s being configured at col: %d\n", + raidPtr->raidid, dev_name, column ); + printf(" Column: %d Num Columns: %d\n", + ci_label->column, + ci_label->num_columns); printf(" Version: %d Serial Number: %d Mod Counter: %d\n", ci_label->version, ci_label->serial_number, ci_label->mod_counter); @@ -724,10 +692,6 @@ static int rf_check_label_vitals( raidPtr, row, column, dev_name, ci_label, printf("Column out of alignment for: %s\n", dev_name); fatal_error = 1; } - if (raidPtr->numRow != ci_label->num_rows) { - printf("Number of rows do not match for: %s\n", dev_name); - fatal_error = 1; - } if (raidPtr->numCol != ci_label->num_columns) { printf("Number of columns do not match for: %s\n", dev_name); fatal_error = 1; @@ -752,7 +716,7 @@ rf_CheckLabels( raidPtr, cfgPtr ) RF_Raid_t *raidPtr; RF_Config_t *cfgPtr; { - int r,c; + int c; char *dev_name; RF_ComponentLabel_t *ci_label; int serial_number = 0; @@ -766,13 +730,11 @@ rf_CheckLabels( raidPtr, cfgPtr ) int num_mod; int i; int found; - int hosed_row; int hosed_column; int too_fatal; int parity_good; int force; - hosed_row = -1; hosed_column = -1; too_fatal = 0; force = cfgPtr->force; @@ -795,42 +757,41 @@ rf_CheckLabels( raidPtr, cfgPtr ) num_ser = 0; num_mod = 0; - for (r = 0; r < raidPtr->numRow && !fatal_error ; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - ci_label = &raidPtr->raid_cinfo[r][c].ci_label; - found=0; - for(i=0;i<num_ser;i++) { - if (ser_values[i] == ci_label->serial_number) { - ser_count[i]++; - found=1; - break; - } + + for (c = 0; c < raidPtr->numCol; c++) { + ci_label = &raidPtr->raid_cinfo[c].ci_label; + found=0; + for(i=0;i<num_ser;i++) { + if (ser_values[i] == ci_label->serial_number) { + ser_count[i]++; + found=1; + break; } - if (!found) { - ser_values[num_ser] = ci_label->serial_number; - ser_count[num_ser] = 1; - num_ser++; - if (num_ser>2) { - fatal_error = 1; - break; - } + } + if (!found) { + ser_values[num_ser] = ci_label->serial_number; + ser_count[num_ser] = 1; + num_ser++; + if (num_ser>2) { + fatal_error = 1; + break; } - found=0; - for(i=0;i<num_mod;i++) { - if (mod_values[i] == ci_label->mod_counter) { - mod_count[i]++; - found=1; - break; - } + } + found=0; + for(i=0;i<num_mod;i++) { + if (mod_values[i] == ci_label->mod_counter) { + mod_count[i]++; + found=1; + break; } - if (!found) { - mod_values[num_mod] = ci_label->mod_counter; - mod_count[num_mod] = 1; - num_mod++; - if (num_mod>2) { - fatal_error = 1; - break; - } + } + if (!found) { + mod_values[num_mod] = ci_label->mod_counter; + mod_count[num_mod] = 1; + num_mod++; + if (num_mod>2) { + fatal_error = 1; + break; } } } @@ -851,27 +812,24 @@ rf_CheckLabels( raidPtr, cfgPtr ) if (ser_count[1] > ser_count[0]) { serial_number = ser_values[1]; } - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - ci_label = &raidPtr->raid_cinfo[r][c].ci_label; - if (serial_number != - ci_label->serial_number) { - hosed_row = r; - hosed_column = c; - break; - } + + for (c = 0; c < raidPtr->numCol; c++) { + ci_label = &raidPtr->raid_cinfo[c].ci_label; + if (serial_number != ci_label->serial_number) { + hosed_column = c; + break; } } printf("Hosed component: %s\n", - &cfgPtr->devnames[hosed_row][hosed_column][0]); + &cfgPtr->devnames[0][hosed_column][0]); if (!force) { /* we'll fail this component, as if there are other major errors, we arn't forcing things and we'll abort the config anyways */ - raidPtr->Disks[hosed_row][hosed_column].status + raidPtr->Disks[hosed_column].status = rf_ds_failed; raidPtr->numFailures++; - raidPtr->status[hosed_row] = rf_rs_degraded; + raidPtr->status = rf_rs_degraded; } } else { too_fatal = 1; @@ -909,37 +867,33 @@ rf_CheckLabels( raidPtr, cfgPtr ) } } - for (r = 0; r < raidPtr->numRow && !too_fatal ; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - ci_label = &raidPtr->raid_cinfo[r][c].ci_label; - if (mod_number != - ci_label->mod_counter) { - if ( ( hosed_row == r ) && - ( hosed_column == c )) { - /* same one. Can - deal with it. */ - } else { - hosed_row = r; - hosed_column = c; - if (num_ser != 1) { - too_fatal = 1; - break; - } + + for (c = 0; c < raidPtr->numCol; c++) { + ci_label = &raidPtr->raid_cinfo[c].ci_label; + if (mod_number != ci_label->mod_counter) { + if (hosed_column == c) { + /* same one. Can + deal with it. */ + } else { + hosed_column = c; + if (num_ser != 1) { + too_fatal = 1; + break; } } } } printf("Hosed component: %s\n", - &cfgPtr->devnames[hosed_row][hosed_column][0]); + &cfgPtr->devnames[0][hosed_column][0]); if (!force) { /* we'll fail this component, as if there are other major errors, we arn't forcing things and we'll abort the config anyways */ - if (raidPtr->Disks[hosed_row][hosed_column].status != rf_ds_failed) { - raidPtr->Disks[hosed_row][hosed_column].status + if (raidPtr->Disks[hosed_column].status != rf_ds_failed) { + raidPtr->Disks[hosed_column].status = rf_ds_failed; raidPtr->numFailures++; - raidPtr->status[hosed_row] = rf_rs_degraded; + raidPtr->status = rf_rs_degraded; } } } else { @@ -959,7 +913,6 @@ rf_CheckLabels( raidPtr, cfgPtr ) mismatch -- and they involved two different components!! Bail -- make things fail so that the user must force the issue... */ - hosed_row = -1; hosed_column = -1; } @@ -977,29 +930,28 @@ rf_CheckLabels( raidPtr, cfgPtr ) that notion at the slightest sign of trouble */ parity_good = RF_RAID_CLEAN; - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - dev_name = &cfgPtr->devnames[r][c][0]; - ci_label = &raidPtr->raid_cinfo[r][c].ci_label; - - if ((r == hosed_row) && (c == hosed_column)) { - printf("raid%d: Ignoring %s\n", - raidPtr->raidid, dev_name); - } else { - rf_print_label_status( raidPtr, r, c, - dev_name, ci_label ); - if (rf_check_label_vitals( raidPtr, r, c, - dev_name, ci_label, - serial_number, - mod_number )) { - fatal_error = 1; - } - if (ci_label->clean != RF_RAID_CLEAN) { - parity_good = RF_RAID_DIRTY; - } + + for (c = 0; c < raidPtr->numCol; c++) { + dev_name = &cfgPtr->devnames[0][c][0]; + ci_label = &raidPtr->raid_cinfo[c].ci_label; + + if (c == hosed_column) { + printf("raid%d: Ignoring %s\n", + raidPtr->raidid, dev_name); + } else { + rf_print_label_status( raidPtr, c, dev_name, ci_label); + if (rf_check_label_vitals( raidPtr, 0, c, + dev_name, ci_label, + serial_number, + mod_number )) { + fatal_error = 1; + } + if (ci_label->clean != RF_RAID_CLEAN) { + parity_good = RF_RAID_DIRTY; } } } + if (fatal_error) { parity_good = RF_RAID_DIRTY; } @@ -1037,12 +989,12 @@ rf_add_hot_spare(raidPtr, sparePtr) RF_UNLOCK_MUTEX(raidPtr->mutex); /* the beginning of the spares... */ - disks = &raidPtr->Disks[0][raidPtr->numCol]; + disks = &raidPtr->Disks[raidPtr->numCol]; spare_number = raidPtr->numSpare; ret = rf_ConfigureDisk(raidPtr, sparePtr->component_name, - &disks[spare_number], 0, + &disks[spare_number], raidPtr->numCol + spare_number); if (ret) @@ -1050,7 +1002,7 @@ rf_add_hot_spare(raidPtr, sparePtr) if (disks[spare_number].status != rf_ds_optimal) { RF_ERRORMSG1("Warning: spare disk %s failed TUR\n", sparePtr->component_name); - rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0); + rf_close_component(raidPtr, raidPtr->raid_cinfo[raidPtr->numCol+spare_number].ci_vp, 0); ret=EINVAL; goto fail; } else { @@ -1068,7 +1020,7 @@ rf_add_hot_spare(raidPtr, sparePtr) bs = 1 << raidPtr->logBytesPerSector; if (disks[spare_number].blockSize != bs) { RF_ERRORMSG3("Block size of %d on spare disk %s is not the same as on other disks (%d)\n", disks[spare_number].blockSize, disks[spare_number].devname, bs); - rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0); + rf_close_component(raidPtr, raidPtr->raid_cinfo[raidPtr->numCol+spare_number].ci_vp, 0); ret = EINVAL; goto fail; } @@ -1077,7 +1029,7 @@ rf_add_hot_spare(raidPtr, sparePtr) disks[spare_number].devname, disks[spare_number].blockSize, (long int) raidPtr->sectorsPerDisk); - rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0); + rf_close_component(raidPtr, raidPtr->raid_cinfo[raidPtr->numCol+spare_number].ci_vp, 0); ret = EINVAL; goto fail; } else { @@ -1090,12 +1042,12 @@ rf_add_hot_spare(raidPtr, sparePtr) } } - spareQueues = &raidPtr->Queues[0][raidPtr->numCol]; + spareQueues = &raidPtr->Queues[raidPtr->numCol]; ret = rf_ConfigureDiskQueue( raidPtr, &spareQueues[spare_number], - 0, raidPtr->numCol + spare_number, + raidPtr->numCol + spare_number, raidPtr->qType, raidPtr->sectorsPerDisk, - raidPtr->Disks[0][raidPtr->numCol + + raidPtr->Disks[raidPtr->numCol + spare_number].dev, raidPtr->maxOutstanding, &raidPtr->shutdownList, @@ -1156,14 +1108,12 @@ rf_delete_component(raidPtr,component) { RF_RaidDisk_t *disks; - if ((component->row < 0) || - (component->row >= raidPtr->numRow) || - (component->column < 0) || + if ((component->column < 0) || (component->column >= raidPtr->numCol)) { return(EINVAL); } - disks = &raidPtr->Disks[component->row][component->column]; + disks = &raidPtr->Disks[component->column]; /* 1. This component must be marked as 'failed' */ diff --git a/sys/dev/raidframe/rf_disks.h b/sys/dev/raidframe/rf_disks.h index e91dbcb20c3..a1c7c03baaa 100644 --- a/sys/dev/raidframe/rf_disks.h +++ b/sys/dev/raidframe/rf_disks.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.h,v 1.10 2001/10/04 15:58:53 oster Exp $ */ +/* $NetBSD: rf_disks.h,v 1.11 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -49,7 +49,7 @@ int rf_ConfigureDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, int rf_ConfigureSpareDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_ConfigureDisk(RF_Raid_t * raidPtr, char *buf, RF_RaidDisk_t * diskPtr, - RF_RowCol_t row, RF_RowCol_t col); + RF_RowCol_t col); int rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *auto_config); int rf_CheckLabels( RF_Raid_t *, RF_Config_t *); diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 48ca7ea70d1..27aba1bb9e3 100644 --- a/sys/dev/raidframe/rf_driver.c +++ b/sys/dev/raidframe/rf_driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.71 2003/06/23 11:02:00 martin Exp $ */ +/* $NetBSD: rf_driver.c,v 1.72 2003/12/29 02:38:17 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -73,7 +73,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.71 2003/06/23 11:02:00 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.72 2003/12/29 02:38:17 oster Exp $"); #include "opt_raid_diagnostic.h" @@ -320,8 +320,8 @@ rf_Configure(raidPtr, cfgPtr, ac) RF_Config_t *cfgPtr; RF_AutoConfig_t *ac; { - RF_RowCol_t row, col; - int i, rc; + RF_RowCol_t col; + int rc; RF_LOCK_LKMGR_MUTEX(configureMutex); configureCount++; @@ -376,34 +376,12 @@ rf_Configure(raidPtr, cfgPtr, ac) DO_RAID_FAIL(); return (rc); } - raidPtr->numRow = cfgPtr->numRow; raidPtr->numCol = cfgPtr->numCol; raidPtr->numSpare = cfgPtr->numSpare; - /* XXX we don't even pretend to support more than one row in the - * kernel... */ - if (raidPtr->numRow != 1) { - RF_ERRORMSG("Only one row supported in kernel.\n"); - DO_RAID_FAIL(); - return (EINVAL); - } - RF_CallocAndAdd(raidPtr->status, raidPtr->numRow, sizeof(RF_RowStatus_t), - (RF_RowStatus_t *), raidPtr->cleanupList); - if (raidPtr->status == NULL) { - DO_RAID_FAIL(); - return (ENOMEM); - } - RF_CallocAndAdd(raidPtr->reconControl, raidPtr->numRow, - sizeof(RF_ReconCtrl_t *), (RF_ReconCtrl_t **), raidPtr->cleanupList); - if (raidPtr->reconControl == NULL) { - DO_RAID_FAIL(); - return (ENOMEM); - } - for (i = 0; i < raidPtr->numRow; i++) { - raidPtr->status[i] = rf_rs_optimal; - raidPtr->reconControl[i] = NULL; - } - + raidPtr->status = rf_rs_optimal; + raidPtr->reconControl = NULL; + TAILQ_INIT(&(raidPtr->iodone)); simple_lock_init(&(raidPtr->iodone_lock)); @@ -439,13 +417,11 @@ rf_Configure(raidPtr, cfgPtr, ac) DO_RAID_INIT_CONFIGURE(rf_ConfigurePSStatus); - for (row = 0; row < raidPtr->numRow; row++) { - for (col = 0; col < raidPtr->numCol; col++) { - /* - * XXX better distribution - */ - raidPtr->hist_diskreq[row][col] = 0; - } + for (col = 0; col < raidPtr->numCol; col++) { + /* + * XXX better distribution + */ + raidPtr->hist_diskreq[col] = 0; } raidPtr->numNewFailures = 0; @@ -472,12 +448,11 @@ rf_Configure(raidPtr, cfgPtr, ac) printf("raid%d: %s\n", raidPtr->raidid, raidPtr->Layout.map->configName); printf("raid%d: Components:", raidPtr->raidid); - for (row = 0; row < raidPtr->numRow; row++) { - for (col = 0; col < raidPtr->numCol; col++) { - printf(" %s", raidPtr->Disks[row][col].devname); - if (RF_DEAD_DISK(raidPtr->Disks[row][col].status)) { - printf("[**FAILED**]"); - } + + for (col = 0; col < raidPtr->numCol; col++) { + printf(" %s", raidPtr->Disks[col].devname); + if (RF_DEAD_DISK(raidPtr->Disks[col].status)) { + printf("[**FAILED**]"); } } printf("\n"); @@ -679,9 +654,8 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel #if 0 /* force the array into reconfigured mode without doing reconstruction */ int -rf_SetReconfiguredMode(raidPtr, row, col) +rf_SetReconfiguredMode(raidPtr, col) RF_Raid_t *raidPtr; - int row; int col; { if (!(raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { @@ -690,13 +664,13 @@ rf_SetReconfiguredMode(raidPtr, row, col) } RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->numFailures++; - raidPtr->Disks[row][col].status = rf_ds_dist_spared; - raidPtr->status[row] = rf_rs_reconfigured; + raidPtr->Disks[col].status = rf_ds_dist_spared; + raidPtr->status = rf_rs_reconfigured; rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE); /* install spare table only if declustering + distributed sparing * architecture. */ if (raidPtr->Layout.map->flags & RF_BD_DECLUSTERED) - rf_InstallSpareTable(raidPtr, row, col); + rf_InstallSpareTable(raidPtr, col); RF_UNLOCK_MUTEX(raidPtr->mutex); return (0); } @@ -705,18 +679,17 @@ rf_SetReconfiguredMode(raidPtr, row, col) int rf_FailDisk( RF_Raid_t * raidPtr, - int frow, int fcol, int initRecon) { RF_LOCK_MUTEX(raidPtr->mutex); - if (raidPtr->Disks[frow][fcol].status != rf_ds_failed) { + if (raidPtr->Disks[fcol].status != rf_ds_failed) { /* must be failing something that is valid, or else it's already marked as failed (in which case we don't want to mark it failed again!) */ raidPtr->numFailures++; - raidPtr->Disks[frow][fcol].status = rf_ds_failed; - raidPtr->status[frow] = rf_rs_degraded; + raidPtr->Disks[fcol].status = rf_ds_failed; + raidPtr->status = rf_rs_degraded; } RF_UNLOCK_MUTEX(raidPtr->mutex); @@ -725,20 +698,20 @@ rf_FailDisk( /* Close the component, so that it's not "locked" if someone else want's to use it! */ - rf_close_component(raidPtr, raidPtr->raid_cinfo[frow][fcol].ci_vp, - raidPtr->Disks[frow][fcol].auto_configured); + rf_close_component(raidPtr, raidPtr->raid_cinfo[fcol].ci_vp, + raidPtr->Disks[fcol].auto_configured); RF_LOCK_MUTEX(raidPtr->mutex); - raidPtr->raid_cinfo[frow][fcol].ci_vp = NULL; + raidPtr->raid_cinfo[fcol].ci_vp = NULL; /* Need to mark the component as not being auto_configured (in case it was previously). */ - raidPtr->Disks[frow][fcol].auto_configured = 0; + raidPtr->Disks[fcol].auto_configured = 0; RF_UNLOCK_MUTEX(raidPtr->mutex); if (initRecon) - rf_ReconstructFailedDisk(raidPtr, frow, fcol); + rf_ReconstructFailedDisk(raidPtr, fcol); return (0); } /* releases a thread that is waiting for the array to become quiesced. diff --git a/sys/dev/raidframe/rf_driver.h b/sys/dev/raidframe/rf_driver.h index c753d1bc6c3..8882fd85a5e 100644 --- a/sys/dev/raidframe/rf_driver.h +++ b/sys/dev/raidframe/rf_driver.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.h,v 1.8 2002/09/23 04:14:20 oster Exp $ */ +/* $NetBSD: rf_driver.h,v 1.9 2003/12/29 02:38:17 oster Exp $ */ /* * rf_driver.h */ @@ -59,8 +59,7 @@ int rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, int async_flag, int rf_SetReconfiguredMode(RF_Raid_t * raidPtr, RF_RowCol_t row, RF_RowCol_t col); #endif -int rf_FailDisk(RF_Raid_t * raidPtr, RF_RowCol_t frow, RF_RowCol_t fcol, - int initRecon); +int rf_FailDisk(RF_Raid_t * raidPtr, RF_RowCol_t fcol, int initRecon); void rf_SignalQuiescenceLock(RF_Raid_t * raidPtr); int rf_SuspendNewRequestsAndWait(RF_Raid_t * raidPtr); void rf_ResumeNewRequests(RF_Raid_t * raidPtr); diff --git a/sys/dev/raidframe/rf_evenodd.h b/sys/dev/raidframe/rf_evenodd.h index 9fa31af8859..497f0ea9c1a 100644 --- a/sys/dev/raidframe/rf_evenodd.h +++ b/sys/dev/raidframe/rf_evenodd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd.h,v 1.2 1999/02/05 00:06:11 oster Exp $ */ +/* $NetBSD: rf_evenodd.h,v 1.3 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. @@ -40,10 +40,10 @@ rf_IdentifyStripeEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids, RF_RowCol_t * outrow); void rf_MapParityEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapEEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_EODagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); diff --git a/sys/dev/raidframe/rf_evenodd_dagfuncs.c b/sys/dev/raidframe/rf_evenodd_dagfuncs.c index dc25b00f53b..d04e263769e 100644 --- a/sys/dev/raidframe/rf_evenodd_dagfuncs.c +++ b/sys/dev/raidframe/rf_evenodd_dagfuncs.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.12 2003/06/23 11:02:00 martin Exp $ */ +/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.13 2003/12/29 02:38:17 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.12 2003/06/23 11:02:00 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.13 2003/12/29 02:38:17 oster Exp $"); #include "rf_archs.h" #include "opt_raid_diagnostic.h" @@ -732,9 +732,9 @@ rf_EvenOddDoubleRecoveryFunc(node) sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress); for (i = 0; i < numDataCol; i++) { npda.raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, npda.raidAddress, &(npda.row), &(npda.col), &(npda.startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, npda.raidAddress, &(npda.col), &(npda.startSector), 0); /* skip over dead disks */ - if (RF_DEAD_DISK(raidPtr->Disks[npda.row][npda.col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[npda.col].status)) if (i != fcol[0]) break; } @@ -912,9 +912,9 @@ rf_EOWriteDoubleRecoveryFunc(node) sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress); for (i = 0; i < numDataCol; i++) { npda.raidAddress = sosAddr + (i * secPerSU); - (raidPtr->Layout.map->MapSector) (raidPtr, npda.raidAddress, &(npda.row), &(npda.col), &(npda.startSector), 0); + (raidPtr->Layout.map->MapSector) (raidPtr, npda.raidAddress, &(npda.col), &(npda.startSector), 0); /* skip over dead disks */ - if (RF_DEAD_DISK(raidPtr->Disks[npda.row][npda.col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[npda.col].status)) if (i != fcol[0]) break; } diff --git a/sys/dev/raidframe/rf_layout.h b/sys/dev/raidframe/rf_layout.h index c54b343c818..c76c4b63d0d 100644 --- a/sys/dev/raidframe/rf_layout.h +++ b/sys/dev/raidframe/rf_layout.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_layout.h,v 1.10 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_layout.h,v 1.11 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -99,7 +99,7 @@ struct RF_RaidLayout_s { #define RF_PDA_TYPE_Q 2 struct RF_PhysDiskAddr_s { - RF_RowCol_t row, col; /* disk identifier */ + RF_RowCol_t col; /* disk identifier */ RF_SectorNum_t startSector; /* sector offset into the disk */ RF_SectorCount_t numSector; /* number of sectors accessed */ int type; /* used by higher levels: currently, data, @@ -135,8 +135,6 @@ struct RF_AccessStripeMap_s { RF_PhysDiskAddr_t *qInfo; /* list of physical addrs for the Q of * P + Q */ RF_LockReqDesc_t lockReqDesc; /* used for stripe locking */ - RF_RowCol_t origRow; /* the original row: we may redirect the acc - * to a different row */ RF_AccessStripeMap_t *next; }; /* flag values */ diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c index 83ab697d3bd..11510aa3262 100644 --- a/sys/dev/raidframe/rf_map.c +++ b/sys/dev/raidframe/rf_map.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_map.c,v 1.22 2003/12/21 19:36:31 oster Exp $ */ +/* $NetBSD: rf_map.c,v 1.23 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_map.c,v 1.22 2003/12/21 19:36:31 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.23 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -92,7 +92,7 @@ rf_MapAccess(raidPtr, raidAddress, numBlocks, buffer, remap) * raidAddress along the * way */ RF_RaidAddr_t endAddress = raidAddress + numBlocks; - RF_RaidDisk_t **disks = raidPtr->Disks; + RF_RaidDisk_t *disks = raidPtr->Disks; RF_PhysDiskAddr_t *pda_p, *pda_q; RF_StripeCount_t numStripes = 0; @@ -165,7 +165,7 @@ rf_MapAccess(raidPtr, raidAddress, numBlocks, buffer, remap) } pda_p->type = RF_PDA_TYPE_DATA; - (layoutPtr->map->MapSector) (raidPtr, raidAddress, &(pda_p->row), &(pda_p->col), &(pda_p->startSector), remap); + (layoutPtr->map->MapSector) (raidPtr, raidAddress, &(pda_p->col), &(pda_p->startSector), remap); /* mark any failures we find. failedPDA is don't-care * if there is more than one failure */ @@ -179,10 +179,6 @@ rf_MapAccess(raidPtr, raidAddress, numBlocks, buffer, remap) pda_p->bufPtr = buffer + rf_RaidAddressToByte(raidPtr, (raidAddress - startAddress)); asm_p->totalSectorsAccessed += pda_p->numSector; asm_p->numStripeUnitsAccessed++; - asm_p->origRow = pda_p->row; /* redundant but - * harmless to do this - * in every loop - * iteration */ raidAddress = RF_MIN(endAddress, nextStripeUnitAddress); } @@ -202,7 +198,7 @@ rf_MapAccess(raidPtr, raidAddress, numBlocks, buffer, remap) pda_p = asm_p->parityInfo = t_pda; pda_p->type = RF_PDA_TYPE_PARITY; (layoutPtr->map->MapParity) (raidPtr, rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe), - &(pda_p->row), &(pda_p->col), &(pda_p->startSector), remap); + &(pda_p->col), &(pda_p->startSector), remap); pda_p->numSector = layoutPtr->sectorsPerStripeUnit; /* raidAddr may be needed to find unit to redirect to */ pda_p->raidAddress = rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe); @@ -223,9 +219,9 @@ rf_MapAccess(raidPtr, raidAddress, numBlocks, buffer, remap) pda_q = asm_p->qInfo = t_pda; pda_q->type = RF_PDA_TYPE_Q; (layoutPtr->map->MapParity) (raidPtr, rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe), - &(pda_p->row), &(pda_p->col), &(pda_p->startSector), remap); + &(pda_p->col), &(pda_p->startSector), remap); (layoutPtr->map->MapQ) (raidPtr, rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe), - &(pda_q->row), &(pda_q->col), &(pda_q->startSector), remap); + &(pda_q->col), &(pda_q->startSector), remap); pda_q->numSector = pda_p->numSector = layoutPtr->sectorsPerStripeUnit; /* raidAddr may be needed to find unit to redirect to */ pda_p->raidAddress = rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe); @@ -266,7 +262,7 @@ rf_MarkFailuresInASMList(raidPtr, asm_h) RF_Raid_t *raidPtr; RF_AccessStripeMapHeader_t *asm_h; { - RF_RaidDisk_t **disks = raidPtr->Disks; + RF_RaidDisk_t *disks = raidPtr->Disks; RF_AccessStripeMap_t *asmap; RF_PhysDiskAddr_t *pda; @@ -276,20 +272,20 @@ rf_MarkFailuresInASMList(raidPtr, asm_h) memset((char *) asmap->failedPDAs, 0, RF_MAX_FAILED_PDA * sizeof(RF_PhysDiskAddr_t *)); for (pda = asmap->physInfo; pda; pda = pda->next) { - if (RF_DEAD_DISK(disks[pda->row][pda->col].status)) { + if (RF_DEAD_DISK(disks[pda->col].status)) { asmap->numDataFailed++; asmap->failedPDAs[asmap->numFailedPDAs] = pda; asmap->numFailedPDAs++; } } pda = asmap->parityInfo; - if (pda && RF_DEAD_DISK(disks[pda->row][pda->col].status)) { + if (pda && RF_DEAD_DISK(disks[pda->col].status)) { asmap->numParityFailed++; asmap->failedPDAs[asmap->numFailedPDAs] = pda; asmap->numFailedPDAs++; } pda = asmap->qInfo; - if (pda && RF_DEAD_DISK(disks[pda->row][pda->col].status)) { + if (pda && RF_DEAD_DISK(disks[pda->col].status)) { asmap->numQFailed++; asmap->failedPDAs[asmap->numFailedPDAs] = pda; asmap->numFailedPDAs++; @@ -535,13 +531,12 @@ rf_CheckStripeForFailures(raidPtr, asmap) RF_Raid_t *raidPtr; RF_AccessStripeMap_t *asmap; { - RF_RowCol_t trow, tcol, prow, pcol, *diskids, i; + RF_RowCol_t tcol, pcol, *diskids, i; RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; RF_StripeCount_t stripeOffset; int numFailures; RF_RaidAddr_t sosAddr; RF_SectorNum_t diskOffset, poffset; - RF_RowCol_t testrow; /* quick out in the fault-free case. */ RF_LOCK_MUTEX(raidPtr->mutex); @@ -551,23 +546,23 @@ rf_CheckStripeForFailures(raidPtr, asmap) return (0); sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress); - (layoutPtr->map->IdentifyStripe) (raidPtr, asmap->raidAddress, &diskids, &testrow); - (layoutPtr->map->MapParity) (raidPtr, asmap->raidAddress, &prow, &pcol, &poffset, 0); /* get pcol */ + (layoutPtr->map->IdentifyStripe) (raidPtr, asmap->raidAddress, &diskids); + (layoutPtr->map->MapParity) (raidPtr, asmap->raidAddress, &pcol, &poffset, 0); /* get pcol */ /* this need not be true if we've redirected the access to a spare in * another row RF_ASSERT(row == testrow); */ stripeOffset = 0; for (i = 0; i < layoutPtr->numDataCol + layoutPtr->numParityCol; i++) { if (diskids[i] != pcol) { - if (RF_DEAD_DISK(raidPtr->Disks[testrow][diskids[i]].status)) { - if (raidPtr->status[testrow] != rf_rs_reconstructing) + if (RF_DEAD_DISK(raidPtr->Disks[diskids[i]].status)) { + if (raidPtr->status != rf_rs_reconstructing) return (1); - RF_ASSERT(raidPtr->reconControl[testrow]->fcol == diskids[i]); + RF_ASSERT(raidPtr->reconControl->fcol == diskids[i]); layoutPtr->map->MapSector(raidPtr, sosAddr + stripeOffset * layoutPtr->sectorsPerStripeUnit, - &trow, &tcol, &diskOffset, 0); - RF_ASSERT((trow == testrow) && (tcol == diskids[i])); - if (!rf_CheckRUReconstructed(raidPtr->reconControl[testrow]->reconMap, diskOffset)) + &tcol, &diskOffset, 0); + RF_ASSERT(tcol == diskids[i]); + if (!rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, diskOffset)) return (1); asmap->flags |= RF_ASM_REDIR_LARGE_WRITE; return (0); @@ -588,7 +583,7 @@ rf_NumFailedDataUnitsInStripe(raidPtr, asmap) RF_AccessStripeMap_t *asmap; { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; - RF_RowCol_t trow, tcol, i; + RF_RowCol_t tcol, i; RF_SectorNum_t diskOffset; RF_RaidAddr_t sosAddr; int numFailures; @@ -605,7 +600,7 @@ rf_NumFailedDataUnitsInStripe(raidPtr, asmap) for (i = 0; i < layoutPtr->numDataCol; i++) { (layoutPtr->map->MapSector) (raidPtr, sosAddr + i * layoutPtr->sectorsPerStripeUnit, &trow, &tcol, &diskOffset, 0); - if (RF_DEAD_DISK(raidPtr->Disks[trow][tcol].status)) + if (RF_DEAD_DISK(raidPtr->Disks[tcol].status)) numFailures++; } @@ -646,15 +641,14 @@ rf_PrintFullAccessStripeMap(asm_h, prbuf) (int) asmap->numDataFailed, (int) asmap->numParityFailed); if (asmap->parityInfo) { - printf("Parity [r%d c%d s%d-%d", asmap->parityInfo->row, asmap->parityInfo->col, + printf("Parity [c%d s%d-%d", asmap->parityInfo->col, (int) asmap->parityInfo->startSector, (int) (asmap->parityInfo->startSector + asmap->parityInfo->numSector - 1)); if (prbuf) printf(" b0x%lx", (unsigned long) asmap->parityInfo->bufPtr); if (asmap->parityInfo->next) { - printf(", r%d c%d s%d-%d", asmap->parityInfo->next->row, - asmap->parityInfo->next->col, + printf(", c%d s%d-%d", asmap->parityInfo->next->col, (int) asmap->parityInfo->next->startSector, (int) (asmap->parityInfo->next->startSector + asmap->parityInfo->next->numSector - 1)); @@ -665,7 +659,7 @@ rf_PrintFullAccessStripeMap(asm_h, prbuf) printf("]\n\t"); } for (i = 0, p = asmap->physInfo; p; p = p->next, i++) { - printf("SU r%d c%d s%d-%d ", p->row, p->col, (int) p->startSector, + printf("SU c%d s%d-%d ", p->col, (int) p->startSector, (int) (p->startSector + p->numSector - 1)); if (prbuf) printf("b0x%lx ", (unsigned long) p->bufPtr); @@ -678,7 +672,7 @@ rf_PrintFullAccessStripeMap(asm_h, prbuf) printf("[multiple failures]\n"); else if (asm_h->stripeMap->numDataFailed + asm_h->stripeMap->numParityFailed > 0) - printf("\t[Failed PDA: r%d c%d s%d-%d]\n", p->row, p->col, + printf("\t[Failed PDA: c%d s%d-%d]\n", p->col, (int) p->startSector, (int) (p->startSector + p->numSector - 1)); } } @@ -772,36 +766,34 @@ rf_ASMCheckStatus( RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda_p, RF_AccessStripeMap_t * asm_p, - RF_RaidDisk_t ** disks, + RF_RaidDisk_t * disks, int parity) { RF_DiskStatus_t dstatus; - RF_RowCol_t frow, fcol; + RF_RowCol_t fcol; - dstatus = disks[pda_p->row][pda_p->col].status; + dstatus = disks[pda_p->col].status; if (dstatus == rf_ds_spared) { /* if the disk has been spared, redirect access to the spare */ - frow = pda_p->row; fcol = pda_p->col; - pda_p->row = disks[frow][fcol].spareRow; - pda_p->col = disks[frow][fcol].spareCol; + pda_p->col = disks[fcol].spareCol; } else if (dstatus == rf_ds_dist_spared) { /* ditto if disk has been spared to dist spare space */ #if RF_DEBUG_MAP - RF_RowCol_t or = pda_p->row, oc = pda_p->col; + RF_RowCol_t oc = pda_p->col; RF_SectorNum_t oo = pda_p->startSector; #endif if (pda_p->type == RF_PDA_TYPE_DATA) - raidPtr->Layout.map->MapSector(raidPtr, pda_p->raidAddress, &pda_p->row, &pda_p->col, &pda_p->startSector, RF_REMAP); + raidPtr->Layout.map->MapSector(raidPtr, pda_p->raidAddress, &pda_p->col, &pda_p->startSector, RF_REMAP); else - raidPtr->Layout.map->MapParity(raidPtr, pda_p->raidAddress, &pda_p->row, &pda_p->col, &pda_p->startSector, RF_REMAP); + raidPtr->Layout.map->MapParity(raidPtr, pda_p->raidAddress, &pda_p->col, &pda_p->startSector, RF_REMAP); #if RF_DEBUG_MAP if (rf_mapDebug) { - printf("Redirected r %d c %d o %d -> r%d c %d o %d\n", or, oc, (int) oo, - pda_p->row, pda_p->col, (int) pda_p->startSector); + printf("Redirected c %d o %d -> c %d o %d\n", oc, (int) oo, + pda_p->col, (int) pda_p->startSector); } #endif } else diff --git a/sys/dev/raidframe/rf_map.h b/sys/dev/raidframe/rf_map.h index 8ae8d8514c2..bfef517179d 100644 --- a/sys/dev/raidframe/rf_map.h +++ b/sys/dev/raidframe/rf_map.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_map.h,v 1.7 2002/09/21 01:14:22 oster Exp $ */ +/* $NetBSD: rf_map.h,v 1.8 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -81,6 +81,6 @@ rf_ASMParityAdjust(RF_PhysDiskAddr_t * toAdjust, void rf_ASMCheckStatus(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda_p, - RF_AccessStripeMap_t * asm_p, RF_RaidDisk_t ** disks, int parity); + RF_AccessStripeMap_t * asm_p, RF_RaidDisk_t * disks, int parity); #endif /* !_RF__RF_MAP_H_ */ diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 33f5b1d4916..49da2455b98 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.165 2003/10/30 01:58:17 simonb Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.166 2003/12/29 02:38:18 oster 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.165 2003/10/30 01:58:17 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.166 2003/12/29 02:38:18 oster Exp $"); #include <sys/param.h> #include <sys/errno.h> @@ -816,7 +816,6 @@ raidioctl(dev, cmd, data, flag, p) RF_DeviceConfig_t *d_cfg, **ucfgp; u_char *specific_buf; int retcode = 0; - int row; int column; int raidid; struct rf_recon_req *rrcopy, *rr; @@ -1036,18 +1035,18 @@ raidioctl(dev, cmd, data, flag, p) return(retcode); } - row = clabel->row; + clabel->row = 0; /* Don't allow looking at anything else.*/ + column = clabel->column; - if ((row < 0) || (row >= raidPtr->numRow) || - (column < 0) || (column >= raidPtr->numCol + + if ((column < 0) || (column >= raidPtr->numCol + raidPtr->numSpare)) { RF_Free( clabel, sizeof(RF_ComponentLabel_t)); return(EINVAL); } - raidread_component_label(raidPtr->Disks[row][column].dev, - raidPtr->raid_cinfo[row][column].ci_vp, + raidread_component_label(raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, clabel ); retcode = copyout(clabel, *clabel_ptr, @@ -1069,18 +1068,15 @@ raidioctl(dev, cmd, data, flag, p) printf("raid%d: Version: %d\n", raidid, clabel->version); printf("raid%d: Serial Number: %d\n", raidid, clabel->serial_number); printf("raid%d: Mod counter: %d\n", raidid, clabel->mod_counter); - printf("raid%d: Row: %d\n", raidid, clabel->row); printf("raid%d: Column: %d\n", raidid, clabel->column); - printf("raid%d: Num Rows: %d\n", raidid, clabel->num_rows); printf("raid%d: Num Columns: %d\n", raidid, clabel->num_columns); printf("raid%d: Clean: %d\n", raidid, clabel->clean); printf("raid%d: Status: %d\n", raidid, clabel->status); - row = clabel->row; + clabel->row = 0; column = clabel->column; - if ((row < 0) || (row >= raidPtr->numRow) || - (column < 0) || (column >= raidPtr->numCol)) { + if ((column < 0) || (column >= raidPtr->numCol)) { return(EINVAL); } @@ -1090,8 +1086,8 @@ raidioctl(dev, cmd, data, flag, p) of the fields!?!?!?! */ #if 0 raidwrite_component_label( - raidPtr->Disks[row][column].dev, - raidPtr->raid_cinfo[row][column].ci_vp, + raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, clabel ); #endif return (0); @@ -1109,19 +1105,17 @@ raidioctl(dev, cmd, data, flag, p) raid_init_component_label(raidPtr, &ci_label); ci_label.serial_number = clabel->serial_number; + ci_label.row = 0; /* we dont' pretend to support more */ - for(row=0;row<raidPtr->numRow;row++) { - ci_label.row = row; - for(column=0;column<raidPtr->numCol;column++) { - diskPtr = &raidPtr->Disks[row][column]; - if (!RF_DEAD_DISK(diskPtr->status)) { - ci_label.partitionSize = diskPtr->partitionSize; - ci_label.column = column; - raidwrite_component_label( - raidPtr->Disks[row][column].dev, - raidPtr->raid_cinfo[row][column].ci_vp, - &ci_label ); - } + for(column=0;column<raidPtr->numCol;column++) { + diskPtr = &raidPtr->Disks[column]; + if (!RF_DEAD_DISK(diskPtr->status)) { + ci_label.partitionSize = diskPtr->partitionSize; + ci_label.column = column; + raidwrite_component_label( + raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, + &ci_label ); } } @@ -1198,16 +1192,15 @@ raidioctl(dev, cmd, data, flag, p) componentPtr = (RF_SingleComponent_t *) data; memcpy( &component, componentPtr, sizeof(RF_SingleComponent_t)); - row = component.row; + component.row = 0; /* we don't support any more */ column = component.column; - if ((row < 0) || (row >= raidPtr->numRow) || - (column < 0) || (column >= raidPtr->numCol)) { + if ((column < 0) || (column >= raidPtr->numCol)) { return(EINVAL); } RF_LOCK_MUTEX(raidPtr->mutex); - if ((raidPtr->Disks[row][column].status == rf_ds_optimal) && + if ((raidPtr->Disks[column].status == rf_ds_optimal) && (raidPtr->numFailures > 0)) { /* XXX 0 above shouldn't be constant!!! */ /* some component other than this has failed. @@ -1215,21 +1208,21 @@ raidioctl(dev, cmd, data, flag, p) are... */ printf("raid%d: Unable to reconstruct to disk at:\n", raidPtr->raidid); - printf("raid%d: Row: %d Col: %d Too many failures.\n", - raidPtr->raidid, row, column); + printf("raid%d: Col: %d Too many failures.\n", + raidPtr->raidid, column); RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } - if (raidPtr->Disks[row][column].status == + if (raidPtr->Disks[column].status == rf_ds_reconstructing) { printf("raid%d: Unable to reconstruct to disk at:\n", raidPtr->raidid); - printf("raid%d: Row: %d Col: %d Reconstruction already occuring!\n", raidPtr->raidid, row, column); + printf("raid%d: Col: %d Reconstruction already occuring!\n", raidPtr->raidid, column); RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } - if (raidPtr->Disks[row][column].status == rf_ds_spared) { + if (raidPtr->Disks[column].status == rf_ds_spared) { RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } @@ -1240,7 +1233,6 @@ raidioctl(dev, cmd, data, flag, p) return(ENOMEM); rrcopy->raidPtr = (void *) raidPtr; - rrcopy->row = row; rrcopy->col = column; retcode = RF_CREATE_THREAD(raidPtr->recon_thread, @@ -1257,9 +1249,9 @@ raidioctl(dev, cmd, data, flag, p) if (d_cfg == NULL) return (ENOMEM); memset((char *) d_cfg, 0, sizeof(RF_DeviceConfig_t)); - d_cfg->rows = raidPtr->numRow; + d_cfg->rows = 1; /* there is only 1 row now */ d_cfg->cols = raidPtr->numCol; - d_cfg->ndevs = raidPtr->numRow * raidPtr->numCol; + d_cfg->ndevs = raidPtr->numCol; if (d_cfg->ndevs >= RF_MAX_DISKS) { RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); return (ENOMEM); @@ -1271,14 +1263,12 @@ raidioctl(dev, cmd, data, flag, p) } d_cfg->maxqdepth = raidPtr->maxQueueDepth; d = 0; - for (i = 0; i < d_cfg->rows; i++) { - for (j = 0; j < d_cfg->cols; j++) { - d_cfg->devs[d] = raidPtr->Disks[i][j]; - d++; - } + for (j = 0; j < d_cfg->cols; j++) { + d_cfg->devs[d] = raidPtr->Disks[j]; + d++; } for (j = d_cfg->cols, i = 0; i < d_cfg->nspares; i++, j++) { - d_cfg->spares[i] = raidPtr->Disks[0][j]; + d_cfg->spares[i] = raidPtr->Disks[j]; } retcode = copyout(d_cfg, *ucfgp, sizeof(RF_DeviceConfig_t)); RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); @@ -1315,21 +1305,20 @@ raidioctl(dev, cmd, data, flag, p) } rr = (struct rf_recon_req *) data; - - if (rr->row < 0 || rr->row >= raidPtr->numRow - || rr->col < 0 || rr->col >= raidPtr->numCol) + rr->row = 0; + if (rr->col < 0 || rr->col >= raidPtr->numCol) return (EINVAL); RF_LOCK_MUTEX(raidPtr->mutex); - if ((raidPtr->Disks[rr->row][rr->col].status == + if ((raidPtr->Disks[rr->col].status == rf_ds_optimal) && (raidPtr->numFailures > 0)) { /* some other component has failed. Let's not make things worse. XXX wrong for RAID6 */ RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } - if (raidPtr->Disks[rr->row][rr->col].status == rf_ds_spared) { + if (raidPtr->Disks[rr->col].status == rf_ds_spared) { /* Can't fail a spared disk! */ RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); @@ -1376,24 +1365,22 @@ raidioctl(dev, cmd, data, flag, p) *(int *) data = 100; return(0); } - row = 0; /* XXX we only consider a single row... */ - if (raidPtr->status[row] != rf_rs_reconstructing) + if (raidPtr->status != rf_rs_reconstructing) *(int *) data = 100; else - *(int *) data = raidPtr->reconControl[row]->percentComplete; + *(int *) data = raidPtr->reconControl->percentComplete; return (0); case RAIDFRAME_CHECK_RECON_STATUS_EXT: progressInfoPtr = (RF_ProgressInfo_t **) data; - row = 0; /* XXX we only consider a single row... */ - if (raidPtr->status[row] != rf_rs_reconstructing) { + if (raidPtr->status != rf_rs_reconstructing) { progressInfo.remaining = 0; progressInfo.completed = 100; progressInfo.total = 100; } else { progressInfo.total = - raidPtr->reconControl[row]->numRUsTotal; + raidPtr->reconControl->numRUsTotal; progressInfo.completed = - raidPtr->reconControl[row]->numRUsComplete; + raidPtr->reconControl->numRUsComplete; progressInfo.remaining = progressInfo.total - progressInfo.completed; } @@ -1907,9 +1894,9 @@ rf_DispatchKernelIO(queue, req) * reqs at any other priority */ queue->curPriority = req->priority; - db1_printf(("Going for %c to unit %d row %d col %d\n", + db1_printf(("Going for %c to unit %d col %d\n", req->type, queue->raidPtr->raidid, - queue->row, queue->col)); + queue->col)); db1_printf(("sector %d count %d (%d bytes) %d\n", (int) req->sectorOffset, (int) req->numSector, (int) (req->numSector << @@ -1978,14 +1965,14 @@ KernelWakeupFunc(vbp) if (bp->b_flags & B_ERROR) { /* Mark the disk as dead */ /* but only mark it once... */ - if (queue->raidPtr->Disks[queue->row][queue->col].status == + if (queue->raidPtr->Disks[queue->col].status == rf_ds_optimal) { printf("raid%d: IO Error. Marking %s as failed.\n", queue->raidPtr->raidid, - queue->raidPtr->Disks[queue->row][queue->col].devname); - queue->raidPtr->Disks[queue->row][queue->col].status = + queue->raidPtr->Disks[queue->col].devname); + queue->raidPtr->Disks[queue->col].status = rf_ds_failed; - queue->raidPtr->status[queue->row] = rf_rs_degraded; + queue->raidPtr->status = rf_rs_degraded; queue->raidPtr->numFailures++; queue->raidPtr->numNewFailures++; } else { /* Disk is already dead... */ @@ -2361,37 +2348,35 @@ rf_markalldirty(raidPtr) { RF_ComponentLabel_t clabel; int sparecol; - int r,c; - int i,j; - int srow = -1, scol = -1; + int c; + int j; + int scol = -1; raidPtr->mod_counter++; - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - /* we don't want to touch (at all) a disk that has - failed */ - if (!RF_DEAD_DISK(raidPtr->Disks[r][c].status)) { - raidread_component_label( - raidPtr->Disks[r][c].dev, - raidPtr->raid_cinfo[r][c].ci_vp, - &clabel); - if (clabel.status == rf_ds_spared) { - /* XXX do something special... - but whatever you do, don't - try to access it!! */ - } else { - raidmarkdirty( - raidPtr->Disks[r][c].dev, - raidPtr->raid_cinfo[r][c].ci_vp, + for (c = 0; c < raidPtr->numCol; c++) { + /* we don't want to touch (at all) a disk that has + failed */ + if (!RF_DEAD_DISK(raidPtr->Disks[c].status)) { + raidread_component_label( + raidPtr->Disks[c].dev, + raidPtr->raid_cinfo[c].ci_vp, + &clabel); + if (clabel.status == rf_ds_spared) { + /* XXX do something special... + but whatever you do, don't + try to access it!! */ + } else { + raidmarkdirty( + raidPtr->Disks[c].dev, + raidPtr->raid_cinfo[c].ci_vp, raidPtr->mod_counter); - } } - } - } + } + } for( c = 0; c < raidPtr->numSpare ; c++) { sparecol = raidPtr->numCol + c; - if (raidPtr->Disks[0][sparecol].status == rf_ds_used_spare) { + if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { /* we claim this disk is "optimal" if it's @@ -2401,35 +2386,29 @@ rf_markalldirty(raidPtr) */ - for(i=0;i<raidPtr->numRow;i++) { - for(j=0;j<raidPtr->numCol;j++) { - if ((raidPtr->Disks[i][j].spareRow == - 0) && - (raidPtr->Disks[i][j].spareCol == - sparecol)) { - srow = i; - scol = j; - break; - } + for(j=0;j<raidPtr->numCol;j++) { + if (raidPtr->Disks[j].spareCol == sparecol) { + scol = j; + break; } } raidread_component_label( - raidPtr->Disks[0][sparecol].dev, - raidPtr->raid_cinfo[0][sparecol].ci_vp, + raidPtr->Disks[sparecol].dev, + raidPtr->raid_cinfo[sparecol].ci_vp, &clabel); /* make sure status is noted */ raid_init_component_label(raidPtr, &clabel); - clabel.row = srow; + clabel.row = 0; clabel.column = scol; /* Note: we *don't* change status from rf_ds_used_spare to rf_ds_optimal */ /* clabel.status = rf_ds_optimal; */ - raidmarkdirty(raidPtr->Disks[0][sparecol].dev, - raidPtr->raid_cinfo[0][sparecol].ci_vp, + raidmarkdirty(raidPtr->Disks[sparecol].dev, + raidPtr->raid_cinfo[sparecol].ci_vp, raidPtr->mod_counter); } } @@ -2443,11 +2422,10 @@ rf_update_component_labels(raidPtr, final) { RF_ComponentLabel_t clabel; int sparecol; - int r,c; - int i,j; - int srow, scol; + int c; + int j; + int scol; - srow = -1; scol = -1; /* XXX should do extra checks to make sure things really are clean, @@ -2455,39 +2433,37 @@ rf_update_component_labels(raidPtr, final) raidPtr->mod_counter++; - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - if (raidPtr->Disks[r][c].status == rf_ds_optimal) { - raidread_component_label( - raidPtr->Disks[r][c].dev, - raidPtr->raid_cinfo[r][c].ci_vp, - &clabel); + for (c = 0; c < raidPtr->numCol; c++) { + if (raidPtr->Disks[c].status == rf_ds_optimal) { + raidread_component_label( + raidPtr->Disks[c].dev, + raidPtr->raid_cinfo[c].ci_vp, + &clabel); /* make sure status is noted */ - clabel.status = rf_ds_optimal; + clabel.status = rf_ds_optimal; /* bump the counter */ - clabel.mod_counter = raidPtr->mod_counter; + clabel.mod_counter = raidPtr->mod_counter; - raidwrite_component_label( - raidPtr->Disks[r][c].dev, - raidPtr->raid_cinfo[r][c].ci_vp, - &clabel); - if (final == RF_FINAL_COMPONENT_UPDATE) { - if (raidPtr->parity_good == RF_RAID_CLEAN) { - raidmarkclean( - raidPtr->Disks[r][c].dev, - raidPtr->raid_cinfo[r][c].ci_vp, - raidPtr->mod_counter); - } + raidwrite_component_label( + raidPtr->Disks[c].dev, + raidPtr->raid_cinfo[c].ci_vp, + &clabel); + if (final == RF_FINAL_COMPONENT_UPDATE) { + if (raidPtr->parity_good == RF_RAID_CLEAN) { + raidmarkclean( + raidPtr->Disks[c].dev, + raidPtr->raid_cinfo[c].ci_vp, + raidPtr->mod_counter); } - } - /* else we don't touch it.. */ + } } - } + /* else we don't touch it.. */ + } for( c = 0; c < raidPtr->numSpare ; c++) { sparecol = raidPtr->numCol + c; /* Need to ensure that the reconstruct actually completed! */ - if (raidPtr->Disks[0][sparecol].status == rf_ds_used_spare) { + if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { /* we claim this disk is "optimal" if it's @@ -2497,41 +2473,34 @@ rf_update_component_labels(raidPtr, final) */ - for(i=0;i<raidPtr->numRow;i++) { - for(j=0;j<raidPtr->numCol;j++) { - if ((raidPtr->Disks[i][j].spareRow == - 0) && - (raidPtr->Disks[i][j].spareCol == - sparecol)) { - srow = i; - scol = j; - break; - } + for(j=0;j<raidPtr->numCol;j++) { + if (raidPtr->Disks[j].spareCol == sparecol) { + scol = j; + break; } } /* XXX shouldn't *really* need this... */ raidread_component_label( - raidPtr->Disks[0][sparecol].dev, - raidPtr->raid_cinfo[0][sparecol].ci_vp, + raidPtr->Disks[sparecol].dev, + raidPtr->raid_cinfo[sparecol].ci_vp, &clabel); /* make sure status is noted */ raid_init_component_label(raidPtr, &clabel); clabel.mod_counter = raidPtr->mod_counter; - clabel.row = srow; clabel.column = scol; clabel.status = rf_ds_optimal; raidwrite_component_label( - raidPtr->Disks[0][sparecol].dev, - raidPtr->raid_cinfo[0][sparecol].ci_vp, + raidPtr->Disks[sparecol].dev, + raidPtr->raid_cinfo[sparecol].ci_vp, &clabel); if (final == RF_FINAL_COMPONENT_UPDATE) { if (raidPtr->parity_good == RF_RAID_CLEAN) { - raidmarkclean( raidPtr->Disks[0][sparecol].dev, - raidPtr->raid_cinfo[0][sparecol].ci_vp, + raidmarkclean( raidPtr->Disks[sparecol].dev, + raidPtr->raid_cinfo[sparecol].ci_vp, raidPtr->mod_counter); } } @@ -2573,21 +2542,20 @@ rf_UnconfigureVnodes(raidPtr) /* We take this opportunity to close the vnodes like we should.. */ - for (r = 0; r < raidPtr->numRow; r++) { - for (c = 0; c < raidPtr->numCol; c++) { - vp = raidPtr->raid_cinfo[r][c].ci_vp; - acd = raidPtr->Disks[r][c].auto_configured; - rf_close_component(raidPtr, vp, acd); - raidPtr->raid_cinfo[r][c].ci_vp = NULL; - raidPtr->Disks[r][c].auto_configured = 0; - } + for (c = 0; c < raidPtr->numCol; c++) { + vp = raidPtr->raid_cinfo[c].ci_vp; + acd = raidPtr->Disks[c].auto_configured; + rf_close_component(raidPtr, vp, acd); + raidPtr->raid_cinfo[c].ci_vp = NULL; + raidPtr->Disks[c].auto_configured = 0; } + for (r = 0; r < raidPtr->numSpare; r++) { - vp = raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp; - acd = raidPtr->Disks[0][raidPtr->numCol + r].auto_configured; + vp = raidPtr->raid_cinfo[raidPtr->numCol + r].ci_vp; + acd = raidPtr->Disks[raidPtr->numCol + r].auto_configured; rf_close_component(raidPtr, vp, acd); - raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp = NULL; - raidPtr->Disks[0][raidPtr->numCol + r].auto_configured = 0; + raidPtr->raid_cinfo[raidPtr->numCol + r].ci_vp = NULL; + raidPtr->Disks[raidPtr->numCol + r].auto_configured = 0; } } @@ -2603,7 +2571,7 @@ rf_ReconThread(req) raidPtr = (RF_Raid_t *) req->raidPtr; raidPtr->recon_in_progress = 1; - rf_FailDisk((RF_Raid_t *) req->raidPtr, req->row, req->col, + rf_FailDisk((RF_Raid_t *) req->raidPtr, req->col, ((req->flags & RF_FDFLAGS_RECON) ? 1 : 0)); /* XXX get rid of this! we don't need it at all.. */ @@ -2674,7 +2642,7 @@ rf_ReconstructInPlaceThread(req) s = splbio(); raidPtr = req->raidPtr; raidPtr->recon_in_progress = 1; - rf_ReconstructInPlace(raidPtr, req->row, req->col); + rf_ReconstructInPlace(raidPtr, req->col); RF_Free(req, sizeof(*req)); raidPtr->recon_in_progress = 0; splx(s); @@ -3022,8 +2990,7 @@ rf_have_enough_components(cset) RF_AutoConfig_t *ac; RF_AutoConfig_t *auto_config; RF_ComponentLabel_t *clabel; - int r,c; - int num_rows; + int c; int num_cols; int num_missing; int mod_counter; @@ -3035,7 +3002,6 @@ rf_have_enough_components(cset) /* check to see that we have enough 'live' components of this set. If so, we can configure it if necessary */ - num_rows = cset->ac->clabel->num_rows; num_cols = cset->ac->clabel->num_columns; parity_type = cset->ac->clabel->parityConfig; @@ -3061,52 +3027,49 @@ rf_have_enough_components(cset) num_missing = 0; auto_config = cset->ac; - for(r=0; r<num_rows; r++) { - even_pair_failed = 0; - for(c=0; c<num_cols; c++) { - ac = auto_config; - while(ac!=NULL) { - if ((ac->clabel->row == r) && - (ac->clabel->column == c) && - (ac->clabel->mod_counter == mod_counter)) { - /* it's this one... */ + even_pair_failed = 0; + for(c=0; c<num_cols; c++) { + ac = auto_config; + while(ac!=NULL) { + if ((ac->clabel->column == c) && + (ac->clabel->mod_counter == mod_counter)) { + /* it's this one... */ #if DEBUG - printf("Found: %s at %d,%d\n", - ac->devname,r,c); + printf("Found: %s at %d\n", + ac->devname,c); #endif - break; - } - ac=ac->next; + break; } - if (ac==NULL) { + ac=ac->next; + } + if (ac==NULL) { /* Didn't find one here! */ /* special case for RAID 1, especially where there are more than 2 components (where RAIDframe treats things a little differently :( ) */ - if (parity_type == '1') { - if (c%2 == 0) { /* even component */ - even_pair_failed = 1; - } else { /* odd component. If - we're failed, and - so is the even - component, it's - "Good Night, Charlie" */ - if (even_pair_failed == 1) { - return(0); - } + if (parity_type == '1') { + if (c%2 == 0) { /* even component */ + even_pair_failed = 1; + } else { /* odd component. If + we're failed, and + so is the even + component, it's + "Good Night, Charlie" */ + if (even_pair_failed == 1) { + return(0); } - } else { - /* normal accounting */ - num_missing++; } + } else { + /* normal accounting */ + num_missing++; } - if ((parity_type == '1') && (c%2 == 1)) { + } + if ((parity_type == '1') && (c%2 == 1)) { /* Just did an even component, and we didn't bail.. reset the even_pair_failed flag, and go on to the next component.... */ - even_pair_failed = 0; - } + even_pair_failed = 0; } } @@ -3136,7 +3099,7 @@ rf_create_configuration(ac,config,raidPtr) clabel = ac->clabel; /* 1. Fill in the common stuff */ - config->numRow = clabel->num_rows; + config->numRow = clabel->num_rows = 1; config->numCol = clabel->num_columns; config->numSpare = 0; /* XXX should this be set here? */ config->sectPerSU = clabel->sectPerSU; @@ -3151,7 +3114,7 @@ rf_create_configuration(ac,config,raidPtr) while(ac!=NULL) { /* row/col values will be in range due to the checks in reasonable_label() */ - strcpy(config->devnames[ac->clabel->row][ac->clabel->column], + strcpy(config->devnames[0][ac->clabel->column], ac->devname); ac = ac->next; } @@ -3169,27 +3132,25 @@ rf_set_autoconfig(raidPtr, new_value) RF_ComponentLabel_t clabel; struct vnode *vp; dev_t dev; - int row, column; + int column; int sparecol; raidPtr->autoconfigure = new_value; - for(row=0; row<raidPtr->numRow; row++) { - for(column=0; column<raidPtr->numCol; column++) { - if (raidPtr->Disks[row][column].status == - rf_ds_optimal) { - dev = raidPtr->Disks[row][column].dev; - vp = raidPtr->raid_cinfo[row][column].ci_vp; - raidread_component_label(dev, vp, &clabel); - clabel.autoconfigure = new_value; - raidwrite_component_label(dev, vp, &clabel); - } + + for(column=0; column<raidPtr->numCol; column++) { + if (raidPtr->Disks[column].status == rf_ds_optimal) { + dev = raidPtr->Disks[column].dev; + vp = raidPtr->raid_cinfo[column].ci_vp; + raidread_component_label(dev, vp, &clabel); + clabel.autoconfigure = new_value; + raidwrite_component_label(dev, vp, &clabel); } } for(column = 0; column < raidPtr->numSpare ; column++) { sparecol = raidPtr->numCol + column; - if (raidPtr->Disks[0][sparecol].status == rf_ds_used_spare) { - dev = raidPtr->Disks[0][sparecol].dev; - vp = raidPtr->raid_cinfo[0][sparecol].ci_vp; + if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { + dev = raidPtr->Disks[sparecol].dev; + vp = raidPtr->raid_cinfo[sparecol].ci_vp; raidread_component_label(dev, vp, &clabel); clabel.autoconfigure = new_value; raidwrite_component_label(dev, vp, &clabel); @@ -3206,27 +3167,24 @@ rf_set_rootpartition(raidPtr, new_value) RF_ComponentLabel_t clabel; struct vnode *vp; dev_t dev; - int row, column; + int column; int sparecol; raidPtr->root_partition = new_value; - for(row=0; row<raidPtr->numRow; row++) { - for(column=0; column<raidPtr->numCol; column++) { - if (raidPtr->Disks[row][column].status == - rf_ds_optimal) { - dev = raidPtr->Disks[row][column].dev; - vp = raidPtr->raid_cinfo[row][column].ci_vp; - raidread_component_label(dev, vp, &clabel); - clabel.root_partition = new_value; - raidwrite_component_label(dev, vp, &clabel); - } + for(column=0; column<raidPtr->numCol; column++) { + if (raidPtr->Disks[column].status == rf_ds_optimal) { + dev = raidPtr->Disks[column].dev; + vp = raidPtr->raid_cinfo[column].ci_vp; + raidread_component_label(dev, vp, &clabel); + clabel.root_partition = new_value; + raidwrite_component_label(dev, vp, &clabel); } } for(column = 0; column < raidPtr->numSpare ; column++) { sparecol = raidPtr->numCol + column; - if (raidPtr->Disks[0][sparecol].status == rf_ds_used_spare) { - dev = raidPtr->Disks[0][sparecol].dev; - vp = raidPtr->raid_cinfo[0][sparecol].ci_vp; + if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { + dev = raidPtr->Disks[sparecol].dev; + vp = raidPtr->raid_cinfo[sparecol].ci_vp; raidread_component_label(dev, vp, &clabel); clabel.root_partition = new_value; raidwrite_component_label(dev, vp, &clabel); @@ -3286,7 +3244,7 @@ raid_init_component_label(raidPtr, clabel) clabel->version = RF_COMPONENT_LABEL_VERSION; clabel->serial_number = raidPtr->serial_number; clabel->mod_counter = raidPtr->mod_counter; - clabel->num_rows = raidPtr->numRow; + clabel->num_rows = 1; clabel->num_columns = raidPtr->numCol; clabel->clean = RF_RAID_DIRTY; /* not clean */ clabel->status = rf_ds_optimal; /* "It's good!" */ diff --git a/sys/dev/raidframe/rf_paritylogDiskMgr.c b/sys/dev/raidframe/rf_paritylogDiskMgr.c index d7c7c5bf793..38fb51127dc 100644 --- a/sys/dev/raidframe/rf_paritylogDiskMgr.c +++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogDiskMgr.c,v 1.14 2002/09/07 23:11:46 oster Exp $ */ +/* $NetBSD: rf_paritylogDiskMgr.c,v 1.15 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.14 2002/09/07 23:11:46 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.15 2003/12/29 02:38:18 oster Exp $"); #include "rf_archs.h" @@ -135,7 +135,7 @@ ReadRegionLog( /* RF_Malloc(*rrd_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t * *)); */ *rrd_pda = rf_AllocPDAList(1); - rf_MapLogParityLogging(raidPtr, regionID, 0, &((*rrd_pda)->row), + rf_MapLogParityLogging(raidPtr, regionID, 0, &((*rrd_pda)->col), &((*rrd_pda)->startSector)); (*rrd_pda)->numSector = raidPtr->regionInfo[regionID].capacity; @@ -192,7 +192,7 @@ WriteCoreLog( *fwr_pda = rf_AllocPDAList(1); regionOffset = log->diskOffset; rf_MapLogParityLogging(raidPtr, regionID, regionOffset, - &((*fwr_pda)->row), &((*fwr_pda)->col), + &((*fwr_pda)->col), &((*fwr_pda)->startSector)); (*fwr_pda)->numSector = raidPtr->numSectorsPerLog; @@ -242,7 +242,7 @@ ReadRegionParity( /* RF_Malloc(*prd_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t * *)); */ *prd_pda = rf_AllocPDAList(1); - rf_MapRegionParity(raidPtr, regionID, &((*prd_pda)->row), + rf_MapRegionParity(raidPtr, regionID, &((*prd_pda)->col), &((*prd_pda)->startSector), &((*prd_pda)->numSector)); if (rf_parityLogDebug) @@ -301,7 +301,7 @@ WriteRegionParity( /* RF_Malloc(*pwr_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t * *)); */ *pwr_pda = rf_AllocPDAList(1); - rf_MapRegionParity(raidPtr, regionID, &((*pwr_pda)->row), + rf_MapRegionParity(raidPtr, regionID, &((*pwr_pda)->col), &((*pwr_pda)->startSector), &((*pwr_pda)->numSector)); diff --git a/sys/dev/raidframe/rf_paritylogging.c b/sys/dev/raidframe/rf_paritylogging.c index ef16a733e98..b15bc1c2597 100644 --- a/sys/dev/raidframe/rf_paritylogging.c +++ b/sys/dev/raidframe/rf_paritylogging.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogging.c,v 1.15 2003/11/16 20:32:05 oster Exp $ */ +/* $NetBSD: rf_paritylogging.c,v 1.16 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.15 2003/11/16 20:32:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.16 2003/12/29 02:38:18 oster Exp $"); #include "rf_archs.h" @@ -104,8 +104,6 @@ rf_ConfigureParityLogging( return (ENOMEM); layoutPtr->layoutSpecificInfo = (void *) info; - RF_ASSERT(raidPtr->numRow == 1); - /* the stripe identifier must identify the disks in each stripe, IN * THE ORDER THAT THEY APPEAR IN THE STRIPE. */ info->stripeIdentifier = rf_make_2d_array((raidPtr->numCol), @@ -817,14 +815,12 @@ void rf_MapSectorParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; /* *col = (SUID % (raidPtr->numCol - * raidPtr->Layout.numParityLogCol)); */ *col = SUID % raidPtr->Layout.numDataCol; @@ -839,7 +835,6 @@ void rf_MapParityParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) @@ -847,7 +842,6 @@ rf_MapParityParityLogging( RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; /* *col = * raidPtr->Layout.numDataCol-(SUID/raidPtr->Layout.numDataCol)%(raidPt * r->numCol - raidPtr->Layout.numParityLogCol); */ @@ -864,11 +858,9 @@ rf_MapLogParityLogging( RF_Raid_t * raidPtr, RF_RegionId_t regionID, RF_SectorNum_t regionOffset, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * startSector) { - *row = 0; *col = raidPtr->numCol - 1; *startSector = raidPtr->regionInfo[regionID].regionStartAddr + regionOffset; } @@ -880,12 +872,10 @@ void rf_MapRegionParity( RF_Raid_t * raidPtr, RF_RegionId_t regionID, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * startSector, RF_SectorCount_t * numSector) { - *row = 0; *col = raidPtr->numCol - 2; *startSector = raidPtr->regionInfo[regionID].parityStartAddr; *numSector = raidPtr->regionInfo[regionID].numSectorsParity; @@ -898,14 +888,12 @@ void rf_IdentifyStripeParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, addr); RF_ParityLoggingConfigInfo_t *info = (RF_ParityLoggingConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; - *outRow = 0; *diskids = info->stripeIdentifier[stripeID % raidPtr->numCol]; } @@ -935,7 +923,7 @@ rf_ParityLoggingDagSelect( { RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout); RF_PhysDiskAddr_t *failedPDA = NULL; - RF_RowCol_t frow, fcol; + RF_RowCol_t fcol; RF_RowStatus_t rstat; int prior_recon; @@ -952,15 +940,14 @@ rf_ParityLoggingDagSelect( * the access to the spare drive and eliminate the * failure indication */ failedPDA = asmp->failedPDAs[0]; - frow = failedPDA->row; fcol = failedPDA->col; - rstat = raidPtr->status[failedPDA->row]; + rstat = raidPtr->status; prior_recon = (rstat == rf_rs_reconfigured) || ( (rstat == rf_rs_reconstructing) ? - rf_CheckRUReconstructed(raidPtr->reconControl[frow]->reconMap, failedPDA->startSector) : 0 + rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, failedPDA->startSector) : 0 ); if (prior_recon) { - RF_RowCol_t or = failedPDA->row, oc = failedPDA->col; + RF_RowCol_t oc = failedPDA->col; RF_SectorNum_t oo = failedPDA->startSector; if (layoutPtr->map->flags & RF_DISTRIBUTE_SPARE) { @@ -969,14 +956,13 @@ rf_ParityLoggingDagSelect( if (failedPDA == asmp->parityInfo) { /* parity has failed */ - (layoutPtr->map->MapParity) (raidPtr, failedPDA->raidAddress, &failedPDA->row, + (layoutPtr->map->MapParity) (raidPtr, failedPDA->raidAddress, &failedPDA->col, &failedPDA->startSector, RF_REMAP); if (asmp->parityInfo->next) { /* redir 2nd component, * if any */ RF_PhysDiskAddr_t *p = asmp->parityInfo->next; RF_SectorNum_t SUoffs = p->startSector % layoutPtr->sectorsPerStripeUnit; - p->row = failedPDA->row; p->col = failedPDA->col; p->startSector = rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, failedPDA->startSector) + SUoffs; /* cheating: @@ -990,7 +976,7 @@ rf_ParityLoggingDagSelect( } else { /* data has failed */ - (layoutPtr->map->MapSector) (raidPtr, failedPDA->raidAddress, &failedPDA->row, + (layoutPtr->map->MapSector) (raidPtr, failedPDA->raidAddress, &failedPDA->col, &failedPDA->startSector, RF_REMAP); } @@ -998,19 +984,16 @@ rf_ParityLoggingDagSelect( } else { /* redirect to dedicated spare space */ - failedPDA->row = raidPtr->Disks[frow][fcol].spareRow; - failedPDA->col = raidPtr->Disks[frow][fcol].spareCol; + failedPDA->col = raidPtr->Disks[fcol].spareCol; /* the parity may have two distinct * components, both of which may need * to be redirected */ if (asmp->parityInfo->next) { if (failedPDA == asmp->parityInfo) { - failedPDA->next->row = failedPDA->row; failedPDA->next->col = failedPDA->col; } else if (failedPDA == asmp->parityInfo->next) { /* paranoid: should never occur */ - asmp->parityInfo->row = failedPDA->row; asmp->parityInfo->col = failedPDA->col; } } @@ -1019,8 +1002,8 @@ rf_ParityLoggingDagSelect( RF_ASSERT(failedPDA->col != -1); if (rf_dagDebug || rf_mapDebug) { - printf("raid%d: Redirected type '%c' r %d c %d o %ld -> r %d c %d o %ld\n", - raidPtr->raidid, type, or, oc, (long) oo, failedPDA->row, failedPDA->col, (long) failedPDA->startSector); + printf("raid%d: Redirected type '%c' c %d o %ld -> c %d o %ld\n", + raidPtr->raidid, type, oc, (long) oo, failedPDA->col, (long) failedPDA->startSector); } asmp->numDataFailed = asmp->numParityFailed = 0; } diff --git a/sys/dev/raidframe/rf_paritylogging.h b/sys/dev/raidframe/rf_paritylogging.h index 7548880a023..6d19d8b260b 100644 --- a/sys/dev/raidframe/rf_paritylogging.h +++ b/sys/dev/raidframe/rf_paritylogging.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylogging.h,v 1.3 1999/02/05 00:06:14 oster Exp $ */ +/* $NetBSD: rf_paritylogging.h,v 1.4 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -41,23 +41,23 @@ rf_MapRegionIDParityLogging(RF_Raid_t * raidPtr, RF_SectorNum_t address); void rf_MapSectorParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapLogParityLogging(RF_Raid_t * raidPtr, RF_RegionId_t regionID, - RF_SectorNum_t regionOffset, RF_RowCol_t * row, RF_RowCol_t * col, + RF_SectorNum_t regionOffset, RF_RowCol_t * col, RF_SectorNum_t * startSector); void rf_MapRegionParity(RF_Raid_t * raidPtr, RF_RegionId_t regionID, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * startSector, + RF_RowCol_t * col, RF_SectorNum_t * startSector, RF_SectorCount_t * numSector); void rf_IdentifyStripeParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDParityLogging(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_parityscan.c b/sys/dev/raidframe/rf_parityscan.c index 833fedc8c67..80e2e2cf279 100644 --- a/sys/dev/raidframe/rf_parityscan.c +++ b/sys/dev/raidframe/rf_parityscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityscan.c,v 1.18 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_parityscan.c,v 1.19 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_parityscan.c,v 1.18 2003/02/09 10:04:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.19 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -74,7 +74,7 @@ rf_RewriteParity(raidPtr) /* There isn't any parity. Call it "okay." */ return (RF_PARITY_OKAY); } - if (raidPtr->status[0] != rf_rs_optimal) { + if (raidPtr->status != rf_rs_optimal) { /* * We're in degraded mode. Don't try to verify parity now! * XXX: this should be a "we don't want to", not a @@ -320,37 +320,35 @@ rf_TryToRedirectPDA(raidPtr, pda, parity) RF_PhysDiskAddr_t *pda; int parity; { - if (raidPtr->Disks[pda->row][pda->col].status == rf_ds_reconstructing) { - if (rf_CheckRUReconstructed(raidPtr->reconControl[pda->row]->reconMap, pda->startSector)) { + if (raidPtr->Disks[pda->col].status == rf_ds_reconstructing) { + if (rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, pda->startSector)) { if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) { #if RF_DEBUG_VERIFYPARITY - RF_RowCol_t or = pda->row, oc = pda->col; + RF_RowCol_t oc = pda->col; RF_SectorNum_t os = pda->startSector; #endif if (parity) { - (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP); + (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->col, &pda->startSector, RF_REMAP); #if RF_DEBUG_VERIFYPARITY if (rf_verifyParityDebug) - printf("VerifyParity: Redir P r %d c %d sect %ld -> r %d c %d sect %ld\n", - or, oc, (long) os, pda->row, pda->col, (long) pda->startSector); + printf("VerifyParity: Redir P c %d sect %ld -> c %d sect %ld\n", + oc, (long) os, pda->col, (long) pda->startSector); #endif } else { - (raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP); + (raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->col, &pda->startSector, RF_REMAP); #if RF_DEBUG_VERIFYPARITY if (rf_verifyParityDebug) - printf("VerifyParity: Redir D r %d c %d sect %ld -> r %d c %d sect %ld\n", - or, oc, (long) os, pda->row, pda->col, (long) pda->startSector); + printf("VerifyParity: Redir D c %d sect %ld -> c %d sect %ld\n", + oc, (long) os, pda->col, (long) pda->startSector); #endif } } else { - RF_RowCol_t spRow = raidPtr->Disks[pda->row][pda->col].spareRow; - RF_RowCol_t spCol = raidPtr->Disks[pda->row][pda->col].spareCol; - pda->row = spRow; + RF_RowCol_t spCol = raidPtr->Disks[pda->col].spareCol; pda->col = spCol; } } } - if (RF_DEAD_DISK(raidPtr->Disks[pda->row][pda->col].status)) + if (RF_DEAD_DISK(raidPtr->Disks[pda->col].status)) return (1); return (0); } diff --git a/sys/dev/raidframe/rf_psstatus.c b/sys/dev/raidframe/rf_psstatus.c index 627e7a67a05..8eba73d5846 100644 --- a/sys/dev/raidframe/rf_psstatus.c +++ b/sys/dev/raidframe/rf_psstatus.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_psstatus.c,v 1.14 2003/12/21 15:56:20 oster Exp $ */ +/* $NetBSD: rf_psstatus.c,v 1.15 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.14 2003/12/21 15:56:20 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.15 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -240,13 +240,12 @@ rf_PSStatusDelete(raidPtr, pssTable, pssPtr) } /* deletes an entry from the ps status table after reconstruction has completed */ void -rf_RemoveFromActiveReconTable(raidPtr, row, psid, which_ru) +rf_RemoveFromActiveReconTable(raidPtr, psid, which_ru) RF_Raid_t *raidPtr; - RF_RowCol_t row; RF_ReconUnitNum_t which_ru; RF_StripeNum_t psid; { - RF_PSStatusHeader_t *hdr = &(raidPtr->reconControl[row]->pssTable[RF_HASH_PSID(raidPtr, psid)]); + RF_PSStatusHeader_t *hdr = &(raidPtr->reconControl->pssTable[RF_HASH_PSID(raidPtr, psid)]); RF_ReconParityStripeStatus_t *p, *pt; RF_CallbackDesc_t *cb, *cb1; @@ -256,7 +255,7 @@ rf_RemoveFromActiveReconTable(raidPtr, row, psid, which_ru) break; } if (p == NULL) { - rf_PrintPSStatusTable(raidPtr, row); + rf_PrintPSStatusTable(raidPtr); } RF_ASSERT(p); /* it must be there */ @@ -360,10 +359,9 @@ RealPrintPSStatusTable(raidPtr, pssTable) } void -rf_PrintPSStatusTable(raidPtr, row) +rf_PrintPSStatusTable(raidPtr) RF_Raid_t *raidPtr; - RF_RowCol_t row; { - RF_PSStatusHeader_t *pssTable = raidPtr->reconControl[row]->pssTable; + RF_PSStatusHeader_t *pssTable = raidPtr->reconControl->pssTable; RealPrintPSStatusTable(raidPtr, pssTable); } diff --git a/sys/dev/raidframe/rf_psstatus.h b/sys/dev/raidframe/rf_psstatus.h index e704faaeaab..190e300671d 100644 --- a/sys/dev/raidframe/rf_psstatus.h +++ b/sys/dev/raidframe/rf_psstatus.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_psstatus.h,v 1.4 2001/10/04 15:58:55 oster Exp $ */ +/* $NetBSD: rf_psstatus.h,v 1.5 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -54,10 +54,10 @@ * descriptor. Note that we use just one lock for the whole hash chain. */ #define RF_HASH_PSID(_raid_,_psid_) ( (_psid_) % ((_raid_)->pssTableSize) ) /* simple hash function */ -#define RF_LOCK_PSS_MUTEX(_raidPtr, _row, _psid) \ - RF_LOCK_MUTEX((_raidPtr)->reconControl[_row]->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex) -#define RF_UNLOCK_PSS_MUTEX(_raidPtr, _row, _psid) \ - RF_UNLOCK_MUTEX((_raidPtr)->reconControl[_row]->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex) +#define RF_LOCK_PSS_MUTEX(_raidPtr, _psid) \ + RF_LOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex) +#define RF_UNLOCK_PSS_MUTEX(_raidPtr, _psid) \ + RF_UNLOCK_MUTEX((_raidPtr)->reconControl->pssTable[ RF_HASH_PSID(_raidPtr,_psid) ].mutex) struct RF_ReconParityStripeStatus_s { RF_StripeNum_t parityStripeID; /* the parity stripe ID */ @@ -123,10 +123,10 @@ void rf_PSStatusDelete(RF_Raid_t * raidPtr, RF_PSStatusHeader_t * pssTable, RF_ReconParityStripeStatus_t * pssPtr); void -rf_RemoveFromActiveReconTable(RF_Raid_t * raidPtr, RF_RowCol_t row, +rf_RemoveFromActiveReconTable(RF_Raid_t * raidPtr, RF_StripeNum_t psid, RF_ReconUnitNum_t which_ru); RF_ReconParityStripeStatus_t *rf_AllocPSStatus(RF_Raid_t * raidPtr); void rf_FreePSStatus(RF_Raid_t * raidPtr, RF_ReconParityStripeStatus_t * p); -void rf_PrintPSStatusTable(RF_Raid_t * raidPtr, RF_RowCol_t row); +void rf_PrintPSStatusTable(RF_Raid_t * raidPtr); #endif /* !_RF__RF_PSSTATUS_H_ */ diff --git a/sys/dev/raidframe/rf_raid.h b/sys/dev/raidframe/rf_raid.h index ba68872cb25..83278113877 100644 --- a/sys/dev/raidframe/rf_raid.h +++ b/sys/dev/raidframe/rf_raid.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.18 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_raid.h,v 1.19 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -101,8 +101,6 @@ struct RF_Raid_s { * changed. XXX this is no longer true. numSpare and friends can * change now. */ - u_int numRow; /* number of rows of disks, typically == # of - * ranks */ u_int numCol; /* number of columns of disks, typically == # * of disks/rank */ u_int numSpare; /* number of spare disks */ @@ -117,8 +115,8 @@ struct RF_Raid_s { RF_int32 sectorMask; /* mask of bytes-per-sector */ RF_RaidLayout_t Layout; /* all information related to layout */ - RF_RaidDisk_t **Disks; /* all information related to physical disks */ - RF_DiskQueue_t **Queues;/* all information related to disk queues */ + RF_RaidDisk_t *Disks; /* all information related to physical disks */ + RF_DiskQueue_t *Queues;/* all information related to disk queues */ const RF_DiskQueueSW_t *qType;/* pointer to the DiskQueueSW used for the component queues. */ /* NOTE: This is an anchor point via which the queues can be @@ -128,7 +126,7 @@ struct RF_Raid_s { * locking on reads and updates */ RF_DECLARE_MUTEX(mutex) /* mutex used to serialize access to * the fields below */ - RF_RowStatus_t *status; /* the status of each row in the array */ + RF_RowStatus_t status; /* the status of each row in the array */ int valid; /* indicates successful configuration */ RF_LockTableEntry_t *lockTable; /* stripe-lock table */ RF_LockTableEntry_t *quiesceLock; /* quiesnce table */ @@ -181,7 +179,7 @@ struct RF_Raid_s { int reconInProgress; RF_DECLARE_COND(waitForReconCond) RF_RaidReconDesc_t *reconDesc; /* reconstruction descriptor */ - RF_ReconCtrl_t **reconControl; /* reconstruction control structure + RF_ReconCtrl_t *reconControl; /* reconstruction control structure * pointers for each row in the array */ /* @@ -260,7 +258,7 @@ struct RF_Raid_s { RF_AccTotals_t acc_totals; int keep_acc_totals; - struct raidcinfo **raid_cinfo; /* array of component info */ + struct raidcinfo *raid_cinfo; /* array of component info */ int terminate_disk_queues; @@ -273,7 +271,7 @@ struct RF_Raid_s { */ /* used by rf_compute_workload_shift */ - RF_RowCol_t hist_diskreq[RF_MAXROW][RF_MAXCOL]; + RF_RowCol_t hist_diskreq[RF_MAXCOL]; /* used by declustering */ int noRotate; diff --git a/sys/dev/raidframe/rf_raid0.c b/sys/dev/raidframe/rf_raid0.c index 2294e3ec7a0..75e783b0954 100644 --- a/sys/dev/raidframe/rf_raid0.c +++ b/sys/dev/raidframe/rf_raid0.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid0.c,v 1.7 2002/09/23 02:40:09 oster Exp $ */ +/* $NetBSD: rf_raid0.c,v 1.8 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_raid0.c,v 1.7 2002/09/23 02:40:09 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid0.c,v 1.8 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -86,13 +86,11 @@ void rf_MapSectorRAID0( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = SUID % raidPtr->numCol; *diskSector = (SUID / raidPtr->numCol) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -102,12 +100,11 @@ void rf_MapParityRAID0( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { - *row = *col = 0; + *col = 0; *diskSector = 0; } @@ -115,14 +112,12 @@ void rf_IdentifyStripeRAID0( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_Raid0ConfigInfo_t *info; info = raidPtr->Layout.layoutSpecificInfo; *diskids = info->stripeIdentifier; - *outRow = 0; } void diff --git a/sys/dev/raidframe/rf_raid0.h b/sys/dev/raidframe/rf_raid0.h index e14d446f6ae..4392a603f43 100644 --- a/sys/dev/raidframe/rf_raid0.h +++ b/sys/dev/raidframe/rf_raid0.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid0.h,v 1.3 1999/02/05 00:06:15 oster Exp $ */ +/* $NetBSD: rf_raid0.h,v 1.4 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,13 +36,13 @@ rf_ConfigureRAID0(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); void rf_MapSectorRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDRAID0(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_raid1.c b/sys/dev/raidframe/rf_raid1.c index 902c9c97bf9..72a7a480362 100644 --- a/sys/dev/raidframe/rf_raid1.c +++ b/sys/dev/raidframe/rf_raid1.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.13 2002/09/23 03:38:51 oster Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.14 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_raid1.c,v 1.13 2002/09/23 03:38:51 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.14 2003/12/29 02:38:18 oster Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -82,8 +82,6 @@ rf_ConfigureRAID1( info->stripeIdentifier[i][1] = (2 * i) + 1; } - RF_ASSERT(raidPtr->numRow == 1); - /* this implementation of RAID level 1 uses one row of numCol disks * and allows multiple (numCol / 2) stripes per row. A stripe * consists of a single data unit and a single parity (mirror) unit. @@ -102,7 +100,6 @@ void rf_MapSectorRAID1( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) @@ -110,7 +107,6 @@ rf_MapSectorRAID1( RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; RF_RowCol_t mirrorPair = SUID % (raidPtr->numCol / 2); - *row = 0; *col = 2 * mirrorPair; *diskSector = ((SUID / (raidPtr->numCol / 2)) * raidPtr->Layout.sectorsPerStripeUnit) + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } @@ -125,7 +121,6 @@ void rf_MapParityRAID1( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) @@ -133,7 +128,6 @@ rf_MapParityRAID1( RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; RF_RowCol_t mirrorPair = SUID % (raidPtr->numCol / 2); - *row = 0; *col = (2 * mirrorPair) + 1; *diskSector = ((SUID / (raidPtr->numCol / 2)) * raidPtr->Layout.sectorsPerStripeUnit) + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -148,14 +142,12 @@ void rf_IdentifyStripeRAID1( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, addr); RF_Raid1ConfigInfo_t *info = raidPtr->Layout.layoutSpecificInfo; RF_ASSERT(stripeID >= 0); RF_ASSERT(addr >= 0); - *outRow = 0; *diskids = info->stripeIdentifier[stripeID % (raidPtr->numCol / 2)]; RF_ASSERT(*diskids); } @@ -194,7 +186,7 @@ rf_RAID1DagSelect( RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc) { - RF_RowCol_t frow, fcol, or, oc; + RF_RowCol_t fcol, oc; RF_PhysDiskAddr_t *failedPDA; int prior_recon; RF_RowStatus_t rstat; @@ -218,23 +210,20 @@ rf_RAID1DagSelect( * spare. Oops. --jimz */ failedPDA = asmap->failedPDAs[0]; - frow = failedPDA->row; fcol = failedPDA->col; - rstat = raidPtr->status[frow]; + rstat = raidPtr->status; prior_recon = (rstat == rf_rs_reconfigured) || ( (rstat == rf_rs_reconstructing) ? - rf_CheckRUReconstructed(raidPtr->reconControl[frow]->reconMap, failedPDA->startSector) : 0 + rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, failedPDA->startSector) : 0 ); if (prior_recon) { - or = frow; oc = fcol; oo = failedPDA->startSector; /* * If we did distributed sparing, we'd monkey with that here. * But we don't, so we'll */ - failedPDA->row = raidPtr->Disks[frow][fcol].spareRow; - failedPDA->col = raidPtr->Disks[frow][fcol].spareCol; + failedPDA->col = raidPtr->Disks[fcol].spareCol; /* * Redirect other components, iff necessary. This looks * pretty suspicious to me, but it's what the raid5 @@ -242,19 +231,17 @@ rf_RAID1DagSelect( */ if (asmap->parityInfo->next) { if (failedPDA == asmap->parityInfo) { - failedPDA->next->row = failedPDA->row; failedPDA->next->col = failedPDA->col; } else { if (failedPDA == asmap->parityInfo->next) { - asmap->parityInfo->row = failedPDA->row; asmap->parityInfo->col = failedPDA->col; } } } if (rf_dagDebug || rf_mapDebug) { - printf("raid%d: Redirected type '%c' r %d c %d o %ld -> r %d c %d o %ld\n", - raidPtr->raidid, type, or, oc, - (long) oo, failedPDA->row, + printf("raid%d: Redirected type '%c' c %d o %ld -> c %d o %ld\n", + raidPtr->raidid, type, oc, + (long) oo, failedPDA->col, (long) failedPDA->startSector); } @@ -572,15 +559,15 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) created = 0; raidPtr = rbuf->raidPtr; - reconCtrlPtr = raidPtr->reconControl[rbuf->row]; + reconCtrlPtr = raidPtr->reconControl; RF_ASSERT(rbuf); RF_ASSERT(rbuf->col != reconCtrlPtr->fcol); #if RF_DEBUG_RECON if (rf_reconbufferDebug) { - printf("raid%d: RAID1 reconbuffer submission r%d c%d psid %ld ru%d (failed offset %ld)\n", - raidPtr->raidid, rbuf->row, rbuf->col, + printf("raid%d: RAID1 reconbuffer submission c%d psid %ld ru%d (failed offset %ld)\n", + raidPtr->raidid, rbuf->col, (long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->failedDiskSectorOffset); } @@ -593,7 +580,7 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) rbuf->buffer[0], rbuf->buffer[1], rbuf->buffer[2], rbuf->buffer[3], rbuf->buffer[4]); } - RF_LOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); + RF_LOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex); @@ -651,12 +638,11 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) && (raidPtr->numFullReconBuffers == 0)) { /* ruh-ro */ RF_ERRORMSG("Buffer wait deadlock\n"); - rf_PrintPSStatusTable(raidPtr, rbuf->row); + rf_PrintPSStatusTable(raidPtr); RF_PANIC(); } pssPtr->flags |= RF_PSS_BUFFERWAIT; cb = rf_AllocCallbackDesc(); - cb->row = rbuf->row; cb->col = rbuf->col; cb->callbackArg.v = rbuf->parityStripeID; cb->callbackArg2.v = rbuf->which_ru; @@ -673,12 +659,10 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) goto out; } if (t != rbuf) { - t->row = rbuf->row; t->col = reconCtrlPtr->fcol; t->parityStripeID = rbuf->parityStripeID; t->which_ru = rbuf->which_ru; t->failedDiskSectorOffset = rbuf->failedDiskSectorOffset; - t->spRow = rbuf->spRow; t->spCol = rbuf->spCol; t->spOffset = rbuf->spOffset; /* Swap buffers. DANCE! */ @@ -700,7 +684,7 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) rf_CheckForFullRbuf(raidPtr, reconCtrlPtr, pssPtr, 1); out: - RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); + RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex); #if RF_DEBUG_RECON if (rf_reconbufferDebug) { diff --git a/sys/dev/raidframe/rf_raid1.h b/sys/dev/raidframe/rf_raid1.h index 7cfb67f9893..4efa1c1e3ca 100644 --- a/sys/dev/raidframe/rf_raid1.h +++ b/sys/dev/raidframe/rf_raid1.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.h,v 1.4 2001/10/04 15:58:55 oster Exp $ */ +/* $NetBSD: rf_raid1.h,v 1.5 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,13 +38,13 @@ rf_ConfigureRAID1(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); void rf_MapSectorRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDRAID1(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_raid4.c b/sys/dev/raidframe/rf_raid4.c index c68d231d636..45493c2f1e4 100644 --- a/sys/dev/raidframe/rf_raid4.c +++ b/sys/dev/raidframe/rf_raid4.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid4.c,v 1.6 2002/09/23 02:40:09 oster Exp $ */ +/* $NetBSD: rf_raid4.c,v 1.7 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_raid4.c,v 1.6 2002/09/23 02:40:09 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid4.c,v 1.7 2003/12/29 02:38:18 oster Exp $"); #include "rf_raid.h" #include "rf_dag.h" @@ -76,8 +76,6 @@ rf_ConfigureRAID4( for (i = 0; i < raidPtr->numCol; i++) info->stripeIdentifier[i] = i; - RF_ASSERT(raidPtr->numRow == 1); - /* fill in the remaining layout parameters */ layoutPtr->numStripe = layoutPtr->stripeUnitsPerDisk; layoutPtr->numDataCol = raidPtr->numCol - 1; @@ -104,13 +102,11 @@ void rf_MapSectorRAID4( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = SUID % raidPtr->Layout.numDataCol; *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -120,14 +116,12 @@ void rf_MapParityRAID4( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = raidPtr->Layout.numDataCol; *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -137,12 +131,10 @@ void rf_IdentifyStripeRAID4( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_Raid4ConfigInfo_t *info = raidPtr->Layout.layoutSpecificInfo; - *outRow = 0; *diskids = info->stripeIdentifier; } diff --git a/sys/dev/raidframe/rf_raid4.h b/sys/dev/raidframe/rf_raid4.h index c29176a7642..6de2689589a 100644 --- a/sys/dev/raidframe/rf_raid4.h +++ b/sys/dev/raidframe/rf_raid4.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid4.h,v 1.3 1999/02/05 00:06:16 oster Exp $ */ +/* $NetBSD: rf_raid4.h,v 1.4 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,13 +38,13 @@ int rf_GetDefaultNumFloatingReconBuffersRAID4(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID4(RF_Raid_t * raidPtr); void rf_MapSectorRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDRAID4(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_raid5.c b/sys/dev/raidframe/rf_raid5.c index 179de54e27a..ec181deb8df 100644 --- a/sys/dev/raidframe/rf_raid5.c +++ b/sys/dev/raidframe/rf_raid5.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid5.c,v 1.8 2003/11/16 20:32:05 oster Exp $ */ +/* $NetBSD: rf_raid5.c,v 1.9 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_raid5.c,v 1.8 2003/11/16 20:32:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid5.c,v 1.9 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -70,8 +70,6 @@ rf_ConfigureRAID5( return (ENOMEM); layoutPtr->layoutSpecificInfo = (void *) info; - RF_ASSERT(raidPtr->numRow == 1); - /* the stripe identifier must identify the disks in each stripe, IN * THE ORDER THAT THEY APPEAR IN THE STRIPE. */ info->stripeIdentifier = rf_make_2d_array(raidPtr->numCol, raidPtr->numCol, raidPtr->cleanupList); @@ -122,13 +120,11 @@ void rf_MapSectorRAID5( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = (SUID % raidPtr->numCol); *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -138,14 +134,12 @@ void rf_MapParityRAID5( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = raidPtr->Layout.numDataCol - (SUID / raidPtr->Layout.numDataCol) % raidPtr->numCol; *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -155,13 +149,11 @@ void rf_IdentifyStripeRAID5( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, addr); RF_Raid5ConfigInfo_t *info = (RF_Raid5ConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; - *outRow = 0; *diskids = info->stripeIdentifier[stripeID % raidPtr->numCol]; } @@ -188,7 +180,7 @@ rf_RaidFiveDagSelect( { RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout); RF_PhysDiskAddr_t *failedPDA = NULL; - RF_RowCol_t frow, fcol; + RF_RowCol_t fcol; RF_RowStatus_t rstat; int prior_recon; @@ -205,15 +197,14 @@ rf_RaidFiveDagSelect( * the access to the spare drive and eliminate the * failure indication */ failedPDA = asmap->failedPDAs[0]; - frow = failedPDA->row; fcol = failedPDA->col; - rstat = raidPtr->status[failedPDA->row]; + rstat = raidPtr->status; prior_recon = (rstat == rf_rs_reconfigured) || ( (rstat == rf_rs_reconstructing) ? - rf_CheckRUReconstructed(raidPtr->reconControl[frow]->reconMap, failedPDA->startSector) : 0 + rf_CheckRUReconstructed(raidPtr->reconControl->reconMap, failedPDA->startSector) : 0 ); if (prior_recon) { - RF_RowCol_t or = failedPDA->row, oc = failedPDA->col; + RF_RowCol_t oc = failedPDA->col; RF_SectorNum_t oo = failedPDA->startSector; if (layoutPtr->map->flags & RF_DISTRIBUTE_SPARE) { /* redirect to dist @@ -222,14 +213,13 @@ rf_RaidFiveDagSelect( if (failedPDA == asmap->parityInfo) { /* parity has failed */ - (layoutPtr->map->MapParity) (raidPtr, failedPDA->raidAddress, &failedPDA->row, + (layoutPtr->map->MapParity) (raidPtr, failedPDA->raidAddress, &failedPDA->col, &failedPDA->startSector, RF_REMAP); if (asmap->parityInfo->next) { /* redir 2nd component, * if any */ RF_PhysDiskAddr_t *p = asmap->parityInfo->next; RF_SectorNum_t SUoffs = p->startSector % layoutPtr->sectorsPerStripeUnit; - p->row = failedPDA->row; p->col = failedPDA->col; p->startSector = rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, failedPDA->startSector) + SUoffs; /* cheating: @@ -243,7 +233,7 @@ rf_RaidFiveDagSelect( } else { /* data has failed */ - (layoutPtr->map->MapSector) (raidPtr, failedPDA->raidAddress, &failedPDA->row, + (layoutPtr->map->MapSector) (raidPtr, failedPDA->raidAddress, &failedPDA->col, &failedPDA->startSector, RF_REMAP); } @@ -251,20 +241,17 @@ rf_RaidFiveDagSelect( } else { /* redirect to dedicated spare * space */ - failedPDA->row = raidPtr->Disks[frow][fcol].spareRow; - failedPDA->col = raidPtr->Disks[frow][fcol].spareCol; + failedPDA->col = raidPtr->Disks[fcol].spareCol; /* the parity may have two distinct * components, both of which may need * to be redirected */ if (asmap->parityInfo->next) { if (failedPDA == asmap->parityInfo) { - failedPDA->next->row = failedPDA->row; failedPDA->next->col = failedPDA->col; } else if (failedPDA == asmap->parityInfo->next) { /* paranoid: should * never occur */ - asmap->parityInfo->row = failedPDA->row; asmap->parityInfo->col = failedPDA->col; } } @@ -273,10 +260,9 @@ rf_RaidFiveDagSelect( RF_ASSERT(failedPDA->col != -1); if (rf_dagDebug || rf_mapDebug) { - printf("raid%d: Redirected type '%c' r %d c %d o %ld -> r %d c %d o %ld\n", - raidPtr->raidid, type, or, oc, - (long) oo, failedPDA->row, - failedPDA->col, + printf("raid%d: Redirected type '%c' c %d o %ld -> c %d o %ld\n", + raidPtr->raidid, type, oc, + (long) oo, failedPDA->col, (long) failedPDA->startSector); } asmap->numDataFailed = asmap->numParityFailed = 0; diff --git a/sys/dev/raidframe/rf_raid5.h b/sys/dev/raidframe/rf_raid5.h index 87da3f0113d..b855abe4867 100644 --- a/sys/dev/raidframe/rf_raid5.h +++ b/sys/dev/raidframe/rf_raid5.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid5.h,v 1.3 1999/02/05 00:06:16 oster Exp $ */ +/* $NetBSD: rf_raid5.h,v 1.4 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,13 +38,13 @@ int rf_GetDefaultNumFloatingReconBuffersRAID5(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID5(RF_Raid_t * raidPtr); void rf_MapSectorRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDRAID5(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_raid5_rotatedspare.c b/sys/dev/raidframe/rf_raid5_rotatedspare.c index 658f4d1c7bb..9994af67381 100644 --- a/sys/dev/raidframe/rf_raid5_rotatedspare.c +++ b/sys/dev/raidframe/rf_raid5_rotatedspare.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid5_rotatedspare.c,v 1.7 2002/09/23 02:40:09 oster Exp $ */ +/* $NetBSD: rf_raid5_rotatedspare.c,v 1.8 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_raid5_rotatedspare.c,v 1.7 2002/09/23 02:40:09 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid5_rotatedspare.c,v 1.8 2003/12/29 02:38:18 oster Exp $"); #include "rf_archs.h" @@ -69,7 +69,6 @@ rf_ConfigureRAID5_RS( return (ENOMEM); layoutPtr->layoutSpecificInfo = (void *) info; - RF_ASSERT(raidPtr->numRow == 1); RF_ASSERT(raidPtr->numCol >= 3); /* the stripe identifier must identify the disks in each stripe, IN @@ -110,14 +109,12 @@ void rf_MapSectorRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; if (remap) { *col = raidPtr->numCol - 1 - (1 + SUID / raidPtr->Layout.numDataCol) % raidPtr->numCol; *col = (*col + 1) % raidPtr->numCol; /* spare unit is rotated @@ -134,14 +131,12 @@ void rf_MapParityRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap) { RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; - *row = 0; *col = raidPtr->numCol - 1 - (1 + SUID / raidPtr->Layout.numDataCol) % raidPtr->numCol; *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); @@ -153,12 +148,10 @@ void rf_IdentifyStripeRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, - RF_RowCol_t * outRow) + RF_RowCol_t ** diskids) { RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, addr); RF_Raid5RSConfigInfo_t *info = (RF_Raid5RSConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; - *outRow = 0; *diskids = info->stripeIdentifier[stripeID % raidPtr->numCol]; } diff --git a/sys/dev/raidframe/rf_raid5_rotatedspare.h b/sys/dev/raidframe/rf_raid5_rotatedspare.h index dce45607d68..6f59e482b68 100644 --- a/sys/dev/raidframe/rf_raid5_rotatedspare.h +++ b/sys/dev/raidframe/rf_raid5_rotatedspare.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid5_rotatedspare.h,v 1.3 1999/02/05 00:06:16 oster Exp $ */ +/* $NetBSD: rf_raid5_rotatedspare.h,v 1.4 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,13 +37,13 @@ rf_ConfigureRAID5_RS(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_ReconUnitCount_t rf_GetNumSpareRUsRAID5_RS(RF_Raid_t * raidPtr); void rf_MapSectorRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_MapParityRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); void rf_IdentifyStripeRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, - RF_RowCol_t ** diskids, RF_RowCol_t * outRow); + RF_RowCol_t ** diskids); void rf_MapSIDToPSIDRAID5_RS(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, diff --git a/sys/dev/raidframe/rf_reconbuffer.c b/sys/dev/raidframe/rf_reconbuffer.c index cb61f744121..be5ec3b698b 100644 --- a/sys/dev/raidframe/rf_reconbuffer.c +++ b/sys/dev/raidframe/rf_reconbuffer.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconbuffer.c,v 1.13 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_reconbuffer.c,v 1.14 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_reconbuffer.c,v 1.13 2003/02/09 10:04:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.14 2003/12/29 02:38:18 oster Exp $"); #include "rf_raid.h" #include "rf_reconbuffer.h" @@ -120,7 +120,7 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) { RF_Raid_t *raidPtr = rbuf->raidPtr; RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; - RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl[rbuf->row]; + RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl; RF_ReconParityStripeStatus_t *pssPtr; RF_ReconBuffer_t *targetRbuf, *t = NULL; /* temporary rbuf * pointers */ @@ -134,10 +134,10 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) RF_ASSERT(rbuf); RF_ASSERT(rbuf->col != reconCtrlPtr->fcol); - Dprintf5("RECON: submission by row %d col %d for psid %ld ru %d (failed offset %ld)\n", - rbuf->row, rbuf->col, (long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->failedDiskSectorOffset); + Dprintf4("RECON: submission by col %d for psid %ld ru %d (failed offset %ld)\n", + rbuf->col, (long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->failedDiskSectorOffset); - RF_LOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); + RF_LOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex); @@ -157,7 +157,7 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) if ((targetRbuf != NULL) && ((pssPtr->xorBufCount == rf_numBufsToAccumulate - 1) || (targetRbuf->count + pssPtr->xorBufCount + 1 == layoutPtr->numDataCol))) { pssPtr->rbufsForXor[pssPtr->xorBufCount++] = rbuf; /* install this buffer */ - Dprintf3("RECON: row %d col %d invoking a %d-way XOR\n", rbuf->row, rbuf->col, pssPtr->xorBufCount); + Dprintf2("RECON: col %d invoking a %d-way XOR\n", rbuf->col, pssPtr->xorBufCount); RF_ETIMER_START(timer); rf_MultiWayReconXor(raidPtr, pssPtr); RF_ETIMER_STOP(timer); @@ -181,10 +181,10 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) t = reconCtrlPtr->committedRbufs; RF_ASSERT(t); reconCtrlPtr->committedRbufs = t->next; - rf_ReleaseFloatingReconBuffer(raidPtr, rbuf->row, t); + rf_ReleaseFloatingReconBuffer(raidPtr, t); } if (keep_it) { - RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); + RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex); rf_FreeReconBuffer(rbuf); return (retcode); @@ -218,7 +218,7 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) raidPtr->procsInBufWait++; if ((raidPtr->procsInBufWait == raidPtr->numCol - 1) && (raidPtr->numFullReconBuffers == 0)) { printf("Buffer wait deadlock detected. Exiting.\n"); - rf_PrintPSStatusTable(raidPtr, rbuf->row); + rf_PrintPSStatusTable(raidPtr); RF_PANIC(); } pssPtr->flags |= RF_PSS_BUFFERWAIT; @@ -276,7 +276,7 @@ rf_SubmitReconBufferBasic(rbuf, keep_it, use_committed) * G=2 */ out: - RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); + RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex); return (retcode); } @@ -310,7 +310,7 @@ rf_MultiWayReconXor(raidPtr, pssPtr) * belongs to the disk whose submission caused this XOR to take place */ for (i = 0; i < numBufs - 1; i++) { if (rbufs[i]->type == RF_RBUF_TYPE_FLOATING) - rf_ReleaseFloatingReconBuffer(raidPtr, rbufs[i]->row, rbufs[i]); + rf_ReleaseFloatingReconBuffer(raidPtr, rbufs[i]); else if (rbufs[i]->type == RF_RBUF_TYPE_FORCED) rf_FreeReconBuffer(rbufs[i]); @@ -373,7 +373,7 @@ rf_CheckForFullRbuf(raidPtr, reconCtrl, pssPtr, numDataCol) } rbuf->pssPtr = pssPtr; pssPtr->rbuf = NULL; - rf_CauseReconEvent(raidPtr, rbuf->row, rbuf->col, NULL, RF_REVENT_BUFREADY); + rf_CauseReconEvent(raidPtr, rbuf->col, NULL, RF_REVENT_BUFREADY); } return (0); } @@ -383,12 +383,11 @@ rf_CheckForFullRbuf(raidPtr, reconCtrl, pssPtr, numDataCol) * assumes the rb_mutex is LOCKED at entry */ void -rf_ReleaseFloatingReconBuffer(raidPtr, row, rbuf) +rf_ReleaseFloatingReconBuffer(raidPtr, rbuf) RF_Raid_t *raidPtr; - RF_RowCol_t row; RF_ReconBuffer_t *rbuf; { - RF_ReconCtrl_t *rcPtr = raidPtr->reconControl[row]; + RF_ReconCtrl_t *rcPtr = raidPtr->reconControl; RF_CallbackDesc_t *cb; Dprintf2("RECON: releasing rbuf for psid %ld ru %d\n", @@ -401,7 +400,7 @@ rf_ReleaseFloatingReconBuffer(raidPtr, row, rbuf) rcPtr->committedRbufs = rbuf; cb = rcPtr->bufferWaitList; rcPtr->bufferWaitList = cb->next; - rf_CauseReconEvent(raidPtr, cb->row, cb->col, (void *) 1, RF_REVENT_BUFCLEAR); /* arg==1 => we've + rf_CauseReconEvent(raidPtr, cb->col, (void *) 1, RF_REVENT_BUFCLEAR); /* arg==1 => we've * committed a buffer */ rf_FreeCallbackDesc(cb); raidPtr->procsInBufWait--; diff --git a/sys/dev/raidframe/rf_reconbuffer.h b/sys/dev/raidframe/rf_reconbuffer.h index 95655f4d43b..fce1bc32274 100644 --- a/sys/dev/raidframe/rf_reconbuffer.h +++ b/sys/dev/raidframe/rf_reconbuffer.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconbuffer.h,v 1.5 2002/09/21 01:21:19 oster Exp $ */ +/* $NetBSD: rf_reconbuffer.h,v 1.6 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -53,7 +53,6 @@ int rf_CheckForFullRbuf(RF_Raid_t * raidPtr, RF_ReconCtrl_t * reconCtrl, RF_ReconParityStripeStatus_t * pssPtr, int numDataCol); void -rf_ReleaseFloatingReconBuffer(RF_Raid_t * raidPtr, RF_RowCol_t row, - RF_ReconBuffer_t * rbuf); +rf_ReleaseFloatingReconBuffer(RF_Raid_t * raidPtr, RF_ReconBuffer_t * rbuf); #endif /* !_RF__RF_RECONBUFFER_H_ */ diff --git a/sys/dev/raidframe/rf_reconmap.c b/sys/dev/raidframe/rf_reconmap.c index e0d71bd32b1..942f1512f54 100644 --- a/sys/dev/raidframe/rf_reconmap.c +++ b/sys/dev/raidframe/rf_reconmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconmap.c,v 1.17 2003/12/21 15:56:20 oster Exp $ */ +/* $NetBSD: rf_reconmap.c,v 1.18 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ *************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.17 2003/12/21 15:56:20 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.18 2003/12/29 02:38:18 oster Exp $"); #include "rf_raid.h" #include <sys/time.h> @@ -356,10 +356,9 @@ PrintList(listPtr) } void -rf_PrintReconMap(raidPtr, mapPtr, frow, fcol) +rf_PrintReconMap(raidPtr, mapPtr, fcol) RF_Raid_t *raidPtr; RF_ReconMap_t *mapPtr; - RF_RowCol_t frow; RF_RowCol_t fcol; { RF_ReconUnitCount_t numRUs; diff --git a/sys/dev/raidframe/rf_reconmap.h b/sys/dev/raidframe/rf_reconmap.h index feda5d1e555..4be42069456 100644 --- a/sys/dev/raidframe/rf_reconmap.h +++ b/sys/dev/raidframe/rf_reconmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconmap.h,v 1.6 2002/10/06 18:49:12 oster Exp $ */ +/* $NetBSD: rf_reconmap.h,v 1.7 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -78,7 +78,7 @@ RF_ReconUnitCount_t rf_UnitsLeftToReconstruct(RF_ReconMap_t * mapPtr); void rf_PrintReconMap(RF_Raid_t * raidPtr, RF_ReconMap_t * mapPtr, - RF_RowCol_t frow, RF_RowCol_t fcol); + RF_RowCol_t fcol); void rf_PrintReconSchedule(RF_ReconMap_t * mapPtr, struct timeval * starttime); 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); } diff --git a/sys/dev/raidframe/rf_reconstruct.h b/sys/dev/raidframe/rf_reconstruct.h index 7b97edec42f..14a75213d13 100644 --- a/sys/dev/raidframe/rf_reconstruct.h +++ b/sys/dev/raidframe/rf_reconstruct.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.h,v 1.9 2002/11/23 01:58:18 oster Exp $ */ +/* $NetBSD: rf_reconstruct.h,v 1.10 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -120,8 +120,7 @@ struct RF_ReconCtrl_s { RF_PerDiskReconCtrl_t *perDiskInfo; /* information maintained * per-disk */ RF_ReconMap_t *reconMap;/* map of what has/has not been reconstructed */ - RF_RowCol_t spareRow; /* which of the spare disks we're using */ - RF_RowCol_t spareCol; + RF_RowCol_t spareCol; /* which of the spare disks we're using */ RF_StripeNum_t lastPSID;/* the ID of the last parity stripe we want * reconstructed */ int percentComplete;/* percentage completion of reconstruction */ @@ -173,15 +172,13 @@ struct RF_ReconCtrl_s { int rf_ConfigureReconstruction(RF_ShutdownList_t ** listp); int -rf_ReconstructFailedDisk(RF_Raid_t * raidPtr, RF_RowCol_t row, - RF_RowCol_t col); +rf_ReconstructFailedDisk(RF_Raid_t * raidPtr, RF_RowCol_t col); int -rf_ReconstructFailedDiskBasic(RF_Raid_t * raidPtr, RF_RowCol_t row, - RF_RowCol_t col); +rf_ReconstructFailedDiskBasic(RF_Raid_t * raidPtr, RF_RowCol_t col); int -rf_ReconstructInPlace(RF_Raid_t * raidPtr, RF_RowCol_t row, RF_RowCol_t col); +rf_ReconstructInPlace(RF_Raid_t * raidPtr,RF_RowCol_t col); int rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t * reconDesc); diff --git a/sys/dev/raidframe/rf_reconutil.c b/sys/dev/raidframe/rf_reconutil.c index 2ce9bd1b26c..743b05c3c33 100644 --- a/sys/dev/raidframe/rf_reconutil.c +++ b/sys/dev/raidframe/rf_reconutil.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconutil.c,v 1.14 2003/02/09 10:04:34 jdolecek Exp $ */ +/* $NetBSD: rf_reconutil.c,v 1.15 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ ********************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.14 2003/02/09 10:04:34 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.15 2003/12/29 02:38:18 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -49,12 +49,10 @@ __KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.14 2003/02/09 10:04:34 jdolecek E * allocates/frees the reconstruction control information structures *******************************************************************/ RF_ReconCtrl_t * -rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) +rf_MakeReconControl(reconDesc, fcol, scol) RF_RaidReconDesc_t *reconDesc; - RF_RowCol_t frow; /* failed row and column */ - RF_RowCol_t fcol; - RF_RowCol_t srow; /* identifies which spare we're using */ - RF_RowCol_t scol; + RF_RowCol_t fcol; /* failed column */ + RF_RowCol_t scol; /* identifies which spare we're using */ { RF_Raid_t *raidPtr = reconDesc->raidPtr; RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -80,7 +78,6 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) sizeof(RF_PerDiskReconCtrl_t), (RF_PerDiskReconCtrl_t *)); reconCtrlPtr->reconDesc = reconDesc; reconCtrlPtr->fcol = fcol; - reconCtrlPtr->spareRow = srow; reconCtrlPtr->spareCol = scol; reconCtrlPtr->lastPSID = layoutPtr->numStripe / layoutPtr->SUsPerPU; reconCtrlPtr->percentComplete = 0; @@ -88,7 +85,6 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) /* initialize each per-disk recon information structure */ for (i = 0; i < raidPtr->numCol; i++) { reconCtrlPtr->perDiskInfo[i].reconCtrl = reconCtrlPtr; - reconCtrlPtr->perDiskInfo[i].row = frow; reconCtrlPtr->perDiskInfo[i].col = i; /* make it appear as if we just finished an RU */ reconCtrlPtr->perDiskInfo[i].curPSID = -1; @@ -109,7 +105,7 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) * Not all distributed sparing archs need dynamic mappings */ if (lp->InstallSpareTable) { - retcode = rf_InstallSpareTable(raidPtr, frow, fcol); + retcode = rf_InstallSpareTable(raidPtr, fcol); if (retcode) { RF_PANIC(); /* XXX fix this */ } @@ -121,7 +117,7 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) /* make the per-disk reconstruction buffers */ for (i = 0; i < raidPtr->numCol; i++) { - reconCtrlPtr->perDiskInfo[i].rbuf = (i == fcol) ? NULL : rf_MakeReconBuffer(raidPtr, frow, i, RF_RBUF_TYPE_EXCLUSIVE); + reconCtrlPtr->perDiskInfo[i].rbuf = (i == fcol) ? NULL : rf_MakeReconBuffer(raidPtr, i, RF_RBUF_TYPE_EXCLUSIVE); } /* initialize the event queue */ @@ -151,7 +147,7 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) reconCtrlPtr->floatingRbufs = NULL; reconCtrlPtr->committedRbufs = NULL; for (i = 0; i < raidPtr->numFloatingReconBufs; i++) { - rbuf = rf_MakeReconBuffer(raidPtr, frow, fcol, + rbuf = rf_MakeReconBuffer(raidPtr, fcol, RF_RBUF_TYPE_FLOATING); rbuf->next = reconCtrlPtr->floatingRbufs; reconCtrlPtr->floatingRbufs = rbuf; @@ -167,11 +163,10 @@ rf_MakeReconControl(reconDesc, frow, fcol, srow, scol) } void -rf_FreeReconControl(raidPtr, row) +rf_FreeReconControl(raidPtr) RF_Raid_t *raidPtr; - RF_RowCol_t row; { - RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl[row]; + RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl; RF_ReconBuffer_t *t; RF_ReconUnitNum_t i; @@ -238,7 +233,6 @@ rf_GetDefaultNumFloatingReconBuffers(raidPtr) RF_ReconBuffer_t * rf_MakeReconBuffer( RF_Raid_t * raidPtr, - RF_RowCol_t row, RF_RowCol_t col, RF_RbufType_t type) { @@ -249,7 +243,6 @@ rf_MakeReconBuffer( RF_Malloc(t, sizeof(RF_ReconBuffer_t), (RF_ReconBuffer_t *)); RF_Malloc(t->buffer, recon_buffer_size, (caddr_t)); t->raidPtr = raidPtr; - t->row = row; t->col = col; t->priority = RF_IO_RECON_PRIORITY; t->type = type; @@ -286,18 +279,10 @@ rf_CheckFloatingRbufCount(raidPtr, dolock) RF_PSStatusHeader_t *pssTable; RF_ReconBuffer_t *rbuf; int i, j, sum = 0; - RF_RowCol_t frow = 0; - - for (i = 0; i < raidPtr->numRow; i++) - if (raidPtr->reconControl[i]) { - frow = i; - break; - } - RF_ASSERT(frow >= 0); if (dolock) - RF_LOCK_MUTEX(raidPtr->reconControl[frow]->rb_mutex); - pssTable = raidPtr->reconControl[frow]->pssTable; + RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex); + pssTable = raidPtr->reconControl->pssTable; for (i = 0; i < raidPtr->pssTableSize; i++) { RF_LOCK_MUTEX(pssTable[i].mutex); @@ -320,17 +305,17 @@ rf_CheckFloatingRbufCount(raidPtr, dolock) RF_UNLOCK_MUTEX(pssTable[i].mutex); } - for (rbuf = raidPtr->reconControl[frow]->floatingRbufs; rbuf; + for (rbuf = raidPtr->reconControl->floatingRbufs; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; } - for (rbuf = raidPtr->reconControl[frow]->committedRbufs; rbuf; + for (rbuf = raidPtr->reconControl->committedRbufs; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; } - for (rbuf = raidPtr->reconControl[frow]->fullBufferList; rbuf; + for (rbuf = raidPtr->reconControl->fullBufferList; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; @@ -338,7 +323,7 @@ rf_CheckFloatingRbufCount(raidPtr, dolock) RF_ASSERT(sum == raidPtr->numFloatingReconBufs); if (dolock) - RF_UNLOCK_MUTEX(raidPtr->reconControl[frow]->rb_mutex); + RF_UNLOCK_MUTEX(raidPtr->reconControl->rb_mutex); } #endif diff --git a/sys/dev/raidframe/rf_reconutil.h b/sys/dev/raidframe/rf_reconutil.h index 6a7ca3e4c1a..6670fce5448 100644 --- a/sys/dev/raidframe/rf_reconutil.h +++ b/sys/dev/raidframe/rf_reconutil.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconutil.h,v 1.4 2001/10/04 15:58:56 oster Exp $ */ +/* $NetBSD: rf_reconutil.h,v 1.5 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -39,13 +39,12 @@ RF_ReconCtrl_t * rf_MakeReconControl(RF_RaidReconDesc_t * reconDesc, - RF_RowCol_t frow, RF_RowCol_t fcol, RF_RowCol_t srow, RF_RowCol_t scol); -void rf_FreeReconControl(RF_Raid_t * raidPtr, RF_RowCol_t row); + RF_RowCol_t fcol, RF_RowCol_t scol); +void rf_FreeReconControl(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimit(RF_Raid_t * raidPtr); int rf_GetDefaultNumFloatingReconBuffers(RF_Raid_t * raidPtr); RF_ReconBuffer_t * -rf_MakeReconBuffer(RF_Raid_t * raidPtr, RF_RowCol_t row, - RF_RowCol_t col, RF_RbufType_t type); +rf_MakeReconBuffer(RF_Raid_t * raidPtr, RF_RowCol_t col, RF_RbufType_t type); void rf_FreeReconBuffer(RF_ReconBuffer_t * rbuf); void rf_CheckFloatingRbufCount(RF_Raid_t * raidPtr, int dolock); diff --git a/sys/dev/raidframe/rf_revent.c b/sys/dev/raidframe/rf_revent.c index eae3fb58226..4ad3c3bda87 100644 --- a/sys/dev/raidframe/rf_revent.c +++ b/sys/dev/raidframe/rf_revent.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_revent.c,v 1.11 2002/09/14 17:54:00 oster Exp $ */ +/* $NetBSD: rf_revent.c,v 1.12 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_revent.c,v 1.11 2002/09/14 17:54:00 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_revent.c,v 1.12 2003/12/29 02:38:18 oster Exp $"); #include <sys/errno.h> @@ -62,8 +62,7 @@ static RF_FreeList_t *rf_revent_freelist; static void rf_ShutdownReconEvent(void *); static RF_ReconEvent_t * -GetReconEventDesc(RF_RowCol_t row, RF_RowCol_t col, - void *arg, RF_Revent_t type); +GetReconEventDesc(RF_RowCol_t col, void *arg, RF_Revent_t type); static void rf_ShutdownReconEvent(ignored) void *ignored; @@ -97,17 +96,15 @@ rf_ConfigureReconEvent(listp) * or will return an event if it is not */ RF_ReconEvent_t * -rf_GetNextReconEvent(reconDesc, row, continueFunc, continueArg) +rf_GetNextReconEvent(reconDesc, continueFunc, continueArg) RF_RaidReconDesc_t *reconDesc; - RF_RowCol_t row; void (*continueFunc) (void *); void *continueArg; { RF_Raid_t *raidPtr = reconDesc->raidPtr; - RF_ReconCtrl_t *rctrl = raidPtr->reconControl[row]; + RF_ReconCtrl_t *rctrl = raidPtr->reconControl; RF_ReconEvent_t *event; - RF_ASSERT(row >= 0 && row <= raidPtr->numRow); RF_LOCK_MUTEX(rctrl->eq_mutex); /* q null and count==0 must be equivalent conditions */ RF_ASSERT((rctrl->eventQueue == NULL) == (rctrl->eq_count == 0)); @@ -177,20 +174,19 @@ rf_GetNextReconEvent(reconDesc, row, continueFunc, continueArg) } /* enqueues a reconstruction event on the indicated queue */ void -rf_CauseReconEvent(raidPtr, row, col, arg, type) +rf_CauseReconEvent(raidPtr, col, arg, type) RF_Raid_t *raidPtr; - RF_RowCol_t row; RF_RowCol_t col; void *arg; RF_Revent_t type; { - RF_ReconCtrl_t *rctrl = raidPtr->reconControl[row]; - RF_ReconEvent_t *event = GetReconEventDesc(row, col, arg, type); + RF_ReconCtrl_t *rctrl = raidPtr->reconControl; + RF_ReconEvent_t *event = GetReconEventDesc(col, arg, type); if (type == RF_REVENT_BUFCLEAR) { RF_ASSERT(col != rctrl->fcol); } - RF_ASSERT(row >= 0 && row <= raidPtr->numRow && col >= 0 && col <= raidPtr->numCol); + RF_ASSERT(col >= 0 && col <= raidPtr->numCol); RF_LOCK_MUTEX(rctrl->eq_mutex); /* q null and count==0 must be equivalent conditions */ RF_ASSERT((rctrl->eventQueue == NULL) == (rctrl->eq_count == 0)); @@ -203,8 +199,7 @@ rf_CauseReconEvent(raidPtr, row, col, arg, type) } /* allocates and initializes a recon event descriptor */ static RF_ReconEvent_t * -GetReconEventDesc(row, col, arg, type) - RF_RowCol_t row; +GetReconEventDesc(col, arg, type) RF_RowCol_t col; void *arg; RF_Revent_t type; diff --git a/sys/dev/raidframe/rf_revent.h b/sys/dev/raidframe/rf_revent.h index 3d61e22526e..9f464fcae8d 100644 --- a/sys/dev/raidframe/rf_revent.h +++ b/sys/dev/raidframe/rf_revent.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_revent.h,v 1.5 2002/09/15 21:04:35 oster Exp $ */ +/* $NetBSD: rf_revent.h,v 1.6 2003/12/29 02:38:18 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -40,11 +40,10 @@ int rf_ConfigureReconEvent(RF_ShutdownList_t ** listp); RF_ReconEvent_t *rf_GetNextReconEvent(RF_RaidReconDesc_t * reconDesc, - RF_RowCol_t row, void (*continueFunc) (void *), void *continueArg); -void rf_CauseReconEvent(RF_Raid_t * raidPtr, RF_RowCol_t row, RF_RowCol_t col, +void rf_CauseReconEvent(RF_Raid_t * raidPtr, RF_RowCol_t col, void *arg, RF_Revent_t type); void rf_FreeReconEventDesc(RF_ReconEvent_t * event); diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c index c506ec166aa..17160eb9bfc 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.20 2002/09/23 04:14:20 oster Exp $ */ +/* $NetBSD: rf_states.c,v 1.21 2003/12/29 02:38:18 oster 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.20 2002/09/23 04:14:20 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.21 2003/12/29 02:38:18 oster Exp $"); #include <sys/errno.h> @@ -376,7 +376,7 @@ rf_State_Lock(RF_RaidAccessDesc_t * desc) } } if (desc->type == RF_IO_TYPE_WRITE && - raidPtr->status[asm_p->physInfo->row] == rf_rs_reconstructing) { + raidPtr->status == rf_rs_reconstructing) { if (!(asm_p->flags & RF_ASM_FLAGS_FORCE_TRIED)) { int val; |
