diff options
Diffstat (limited to 'sys/dev/raidframe')
96 files changed, 1671 insertions, 1671 deletions
diff --git a/sys/dev/raidframe/raidframeio.h b/sys/dev/raidframe/raidframeio.h index beabd8d4a03..4bfedfcfd91 100644 --- a/sys/dev/raidframe/raidframeio.h +++ b/sys/dev/raidframe/raidframeio.h @@ -1,4 +1,4 @@ -/* $NetBSD: raidframeio.h,v 1.1 2001/10/04 15:43:57 oster Exp $ */ +/* $NetBSD: raidframeio.h,v 1.2 2005/02/27 00:27:44 perry Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -113,8 +113,8 @@ * for device */ #define RAIDFRAME_KEEP_ACCTOTALS _IOW ('r', 18, int) /* turn AccTotals on or * off for device */ -#define RAIDFRAME_GET_COMPONENT_LABEL _IOWR ('r', 19, RF_ComponentLabel_t *) -#define RAIDFRAME_SET_COMPONENT_LABEL _IOW ('r', 20, RF_ComponentLabel_t) +#define RAIDFRAME_GET_COMPONENT_LABEL _IOWR ('r', 19, RF_ComponentLabel_t *) +#define RAIDFRAME_SET_COMPONENT_LABEL _IOW ('r', 20, RF_ComponentLabel_t) #define RAIDFRAME_INIT_LABELS _IOW ('r', 21, RF_ComponentLabel_t) #define RAIDFRAME_ADD_HOT_SPARE _IOW ('r', 22, RF_SingleComponent_t) diff --git a/sys/dev/raidframe/raidframevar.h b/sys/dev/raidframe/raidframevar.h index 393e89bb283..86bc6ca9aaf 100644 --- a/sys/dev/raidframe/raidframevar.h +++ b/sys/dev/raidframe/raidframevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.7 2004/06/02 22:58:28 drochner Exp $ */ +/* $NetBSD: raidframevar.h,v 1.8 2005/02/27 00:27:44 perry Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -274,7 +274,7 @@ typedef struct RF_ThroughputStats_s RF_ThroughputStats_t; /* * Important assumptions regarding ordering of the states in this list - * have been made!!! Before disturbing this ordering, look at code in + * have been made!!! Before disturbing this ordering, look at code in * sys/dev/raidframe/rf_states.c */ typedef enum RF_AccessState_e { @@ -293,7 +293,7 @@ typedef enum RF_AccessState_e { } RF_AccessState_t; -/* Some constants related to RAIDframe. These are arbitrary and +/* Some constants related to RAIDframe. These are arbitrary and can be modified at will. */ #define RF_MAXROW 10 @@ -348,9 +348,9 @@ struct RF_Config_s { * be copied in */ int force; /* if !0, ignore many fatal configuration conditions */ - /* - "force" is used to override cases where the component labels would - indicate that configuration should not proceed without user + /* + "force" is used to override cases where the component labels would + indicate that configuration should not proceed without user intervention */ }; @@ -412,7 +412,7 @@ struct RF_RaidDisk_s { RF_SectorCount_t numBlocks; /* number of blocks, obtained via READ * CAPACITY */ int blockSize; - RF_SectorCount_t partitionSize; /* The *actual* and *full* size of + RF_SectorCount_t partitionSize; /* The *actual* and *full* size of the partition, from the disklabel */ int auto_configured;/* 1 if this component was autoconfigured. 0 otherwise. */ @@ -432,7 +432,7 @@ typedef struct RF_ComponentLabel_s { int serial_number; /* a user-specified serial number for this RAID set */ int mod_counter; /* modification counter. Changed (usually - by incrementing) every time the label + by incrementing) every time the label is changed */ int row; /* the row number of this component */ int column; /* the column number of this component */ @@ -446,23 +446,23 @@ typedef struct RF_ComponentLabel_s { int SUsPerRU; /* Stripe Units per Reconstruction Units */ int parityConfig; /* '0' == RAID0, '1' == RAID1, etc. */ int maxOutstanding; /* maxOutstanding disk requests */ - int blockSize; /* size of component block. + int blockSize; /* size of component block. (disklabel->d_secsize) */ int numBlocks; /* number of blocks on this component. May be smaller than the partition size. */ - int partitionSize; /* number of blocks on this *partition*. + int partitionSize; /* number of blocks on this *partition*. Must exactly match the partition size from the disklabel. */ int future_use[33]; /* Future expansion */ - int autoconfigure; /* automatically configure this RAID set. + int autoconfigure; /* automatically configure this RAID set. 0 == no, 1 == yes */ int root_partition; /* Use this set as / 0 == no, 1 == yes*/ - int last_unit; /* last unit number (e.g. 0 for /dev/raid0) + int last_unit; /* last unit number (e.g. 0 for /dev/raid0) of this component. Used for autoconfigure only. */ int config_order; /* 0 .. n. The order in which the component - should be auto-configured. E.g. 0 is will + should be auto-configured. E.g. 0 is will done first, (and would become raid0). This may be in conflict with last_unit!!?! */ /* Not currently used. */ @@ -473,7 +473,7 @@ typedef struct RF_SingleComponent_s { int row; int column; char component_name[50]; /* name of the component */ -} RF_SingleComponent_t; +} RF_SingleComponent_t; typedef struct RF_DeviceConfig_s { u_int rows; @@ -498,29 +498,29 @@ typedef struct RF_LayoutSW_s { #ifndef _KERNEL /* layout-specific parsing */ - int (*MakeLayoutSpecific) (FILE * fp, RF_Config_t * cfgPtr, + int (*MakeLayoutSpecific) (FILE * fp, RF_Config_t * cfgPtr, void *arg); void *makeLayoutSpecificArg; #else /* !KERNEL */ /* initialization routine */ - int (*Configure) (RF_ShutdownList_t ** shutdownListp, + int (*Configure) (RF_ShutdownList_t ** shutdownListp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); /* routine to map RAID sector address -> physical (row, col, offset) */ void (*MapSector) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, - 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 * 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 * col, + void (*MapQ) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, + RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); /* routine to identify the disks comprising a stripe */ @@ -534,9 +534,9 @@ typedef struct RF_LayoutSW_s { /* map a stripe ID to a parity stripe ID. This is typically the * identity mapping */ - void (*MapSIDToPSID) (RF_RaidLayout_t * layoutPtr, + void (*MapSIDToPSID) (RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, - RF_StripeNum_t * psID, + RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); /* get default head separation limit (may be NULL) */ @@ -549,7 +549,7 @@ typedef struct RF_LayoutSW_s { RF_ReconUnitCount_t(*GetNumSpareRUs) (RF_Raid_t * raidPtr); /* spare table installation (may be NULL) */ - int (*InstallSpareTable) (RF_Raid_t * raidPtr, RF_RowCol_t frow, + int (*InstallSpareTable) (RF_Raid_t * raidPtr, RF_RowCol_t frow, RF_RowCol_t fcol); /* recon buffer submission function */ @@ -561,7 +561,7 @@ typedef struct RF_LayoutSW_s { * see rf_parityscan.h for return vals */ int (*VerifyParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr, - RF_PhysDiskAddr_t * parityPDA, + RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags); /* number of faults tolerated by this mapping */ diff --git a/sys/dev/raidframe/rf_acctrace.c b/sys/dev/raidframe/rf_acctrace.c index cdc2dbbb451..2f5ce8d7366 100644 --- a/sys/dev/raidframe/rf_acctrace.c +++ b/sys/dev/raidframe/rf_acctrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_acctrace.c,v 1.19 2004/03/01 23:30:57 oster Exp $ */ +/* $NetBSD: rf_acctrace.c,v 1.20 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.19 2004/03/01 23:30:57 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.20 2005/02/27 00:27:44 perry Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -54,7 +54,7 @@ static long numTracesSoFar; RF_DECLARE_MUTEX(rf_tracing_mutex) -int +int rf_ConfigureAccessTrace(RF_ShutdownList_t **listp) { numTracesSoFar = 0; @@ -63,9 +63,9 @@ rf_ConfigureAccessTrace(RF_ShutdownList_t **listp) } /* install a trace record. cause a flush to disk or to the trace - * collector daemon if the trace buffer is at least 1/2 full. + * collector daemon if the trace buffer is at least 1/2 full. */ -void +void rf_LogTraceRec(RF_Raid_t *raid, RF_AccTraceEntry_t *rec) { RF_AccTotals_t *acc = &raid->acc_totals; diff --git a/sys/dev/raidframe/rf_alloclist.c b/sys/dev/raidframe/rf_alloclist.c index cbd5db2bb0f..95d062627d1 100644 --- a/sys/dev/raidframe/rf_alloclist.c +++ b/sys/dev/raidframe/rf_alloclist.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_alloclist.c,v 1.21 2004/03/07 22:15:19 oster Exp $ */ +/* $NetBSD: rf_alloclist.c,v 1.22 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ ***************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.21 2004/03/07 22:15:19 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.22 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -62,7 +62,7 @@ static void rf_ShutdownAllocList(void *ignored) pool_destroy(&rf_pools.alloclist); } -int +int rf_ConfigureAllocList(RF_ShutdownList_t **listp) { @@ -78,7 +78,7 @@ rf_ConfigureAllocList(RF_ShutdownList_t **listp) * to search for the end. If you ever observe the lists growing longer, * increase POINTERS_PER_ALLOC_LIST_ELEMENT. */ -void +void rf_real_AddToAllocList(RF_AllocListElem_t *l, void *p, int size) { RF_AllocListElem_t *newelem; @@ -98,14 +98,14 @@ rf_real_AddToAllocList(RF_AllocListElem_t *l, void *p, int size) } -void +void rf_FreeAllocList(RF_AllocListElem_t *l) { int i; RF_AllocListElem_t *temp, *p; for (p = l; p; p = p->next) { - RF_ASSERT(p->numPointers >= 0 && + RF_ASSERT(p->numPointers >= 0 && p->numPointers <= RF_POINTERS_PER_ALLOC_LIST_ELEMENT); for (i = 0; i < p->numPointers; i++) { RF_ASSERT(p->pointers[i]); diff --git a/sys/dev/raidframe/rf_archs.h b/sys/dev/raidframe/rf_archs.h index 3db7cdf2d44..aba4668f261 100644 --- a/sys/dev/raidframe/rf_archs.h +++ b/sys/dev/raidframe/rf_archs.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_archs.h,v 1.24 2004/03/09 03:10:26 oster Exp $ */ +/* $NetBSD: rf_archs.h,v 1.25 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,11 +48,11 @@ #ifndef _RF__RF_ARCHS_H_ #define _RF__RF_ARCHS_H_ -#ifndef RF_INCLUDE_EVENODD +#ifndef RF_INCLUDE_EVENODD #define RF_INCLUDE_EVENODD 0 #endif -#ifndef RF_INCLUDE_RAID5_RS +#ifndef RF_INCLUDE_RAID5_RS #define RF_INCLUDE_RAID5_RS 0 #endif diff --git a/sys/dev/raidframe/rf_aselect.c b/sys/dev/raidframe/rf_aselect.c index 9abafa7944c..5d4b86f536a 100644 --- a/sys/dev/raidframe/rf_aselect.c +++ b/sys/dev/raidframe/rf_aselect.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_aselect.c,v 1.20 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_aselect.c,v 1.21 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.20 2004/04/09 23:10:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.21 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -102,7 +102,7 @@ InitHdrNode(RF_DagHeader_t **hdr, RF_Raid_t *raidPtr, RF_RaidAccessDesc_t *desc) #define MAXNSTRIPES 50 -int +int rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) { RF_AccessStripeMapHeader_t *asm_h = desc->asmap; @@ -170,7 +170,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) /* could not find creation function for entire stripe * so, let's see if we can find one for each stripe * unit in the stripe */ - + /* create a failed stripe structure to attempt to deal with the failure */ failed_stripe = rf_AllocFailedStripeStruct(); if (failed_stripes_list == NULL) { @@ -185,7 +185,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) * stripeFuncs) for this stripe */ numStripeUnits = asm_p->numStripeUnitsAccessed; - /* lookup array of stripeUnitFuncs for this stripe */ + /* lookup array of stripeUnitFuncs for this stripe */ failed_stripes_asmh_u_end = NULL; failed_stripes_vfple_end = NULL; for (j = 0, physPtr = asm_p->physInfo; physPtr; physPtr = physPtr->next, j++) { @@ -204,8 +204,8 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) failed_stripes_asmh_u_end->next = asmhle; failed_stripes_asmh_u_end = asmhle; } - - + + asmhle->asmh = rf_MapAccess(raidPtr, address, length, buffer, RF_DONT_REMAP); asm_up = asmhle->asmh->stripeMap; @@ -253,7 +253,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) asmhle->asmh = rf_MapAccess(raidPtr, address, length, buffer, RF_DONT_REMAP); asm_bp = asmhle->asmh->stripeMap; - + vfple = rf_AllocVFPListElem(); if (failed_stripe->bvfple == NULL) { failed_stripe->bvfple = vfple; @@ -305,7 +305,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) rf_FreeAccessStripeMap(tmpasmhle->asmh); rf_FreeASMHeaderListElem(tmpasmhle); } - + vfple = failed_stripe->vfple; while (vfple) { tmpvfple = vfple; @@ -526,14 +526,14 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags) vfple = tmpvfple->next; rf_FreeVFPListElem(tmpvfple); } - + vfple = failed_stripe->bvfple; while (vfple) { tmpvfple = vfple; vfple = tmpvfple->next; rf_FreeVFPListElem(tmpvfple); } - + tmpfailed_stripe = failed_stripe; failed_stripe = tmpfailed_stripe->next; rf_FreeFailedStripeStruct(tmpfailed_stripe); diff --git a/sys/dev/raidframe/rf_callback.c b/sys/dev/raidframe/rf_callback.c index ee358050166..1b284ab7c55 100644 --- a/sys/dev/raidframe/rf_callback.c +++ b/sys/dev/raidframe/rf_callback.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_callback.c,v 1.16 2004/03/07 22:15:19 oster Exp $ */ +/* $NetBSD: rf_callback.c,v 1.17 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.16 2004/03/07 22:15:19 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.17 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> #include <sys/pool.h> @@ -51,13 +51,13 @@ __KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.16 2004/03/07 22:15:19 oster Exp $ #define RF_MIN_FREE_CALLBACK 32 static void rf_ShutdownCallback(void *); -static void +static void rf_ShutdownCallback(void *ignored) { pool_destroy(&rf_pools.callback); } -int +int rf_ConfigureCallback(listp) RF_ShutdownList_t **listp; { @@ -78,7 +78,7 @@ rf_AllocCallbackDesc() return (p); } -void +void rf_FreeCallbackDesc(p) RF_CallbackDesc_t *p; { diff --git a/sys/dev/raidframe/rf_chaindecluster.c b/sys/dev/raidframe/rf_chaindecluster.c index 71d050d7c1b..ef5a599c968 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.11 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_chaindecluster.c,v 1.12 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,11 +33,11 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.11 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.12 2005/02/27 00:27:44 perry Exp $"); #include "rf_archs.h" -#if (RF_INCLUDE_CHAINDECLUSTER > 0) +#if (RF_INCLUDE_CHAINDECLUSTER > 0) #include <dev/raidframe/raidframevar.h> @@ -60,7 +60,7 @@ typedef struct RF_ChaindeclusterConfigInfo_s { RF_SectorNum_t mirrorStripeOffset; } RF_ChaindeclusterConfigInfo_t; -int +int rf_ConfigureChainDecluster(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -108,7 +108,7 @@ rf_ConfigureChainDecluster(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -RF_ReconUnitCount_t +RF_ReconUnitCount_t rf_GetNumSpareRUsChainDecluster(RF_Raid_t *raidPtr) { RF_ChaindeclusterConfigInfo_t *info = (RF_ChaindeclusterConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; @@ -122,7 +122,7 @@ rf_GetNumSpareRUsChainDecluster(RF_Raid_t *raidPtr) /* Maps to the primary copy of the data, i.e. the first mirror pair */ -void +void rf_MapSectorChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -166,7 +166,7 @@ rf_MapSectorChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, /* Maps to the second copy of the mirror pair, which is chain declustered. The second copy is contained in the next disk (mod numCol) after the disk containing the primary copy. The offset into the disk is one-half disk down */ -void +void rf_MapParityChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -204,7 +204,7 @@ rf_MapParityChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, } -void +void rf_IdentifyStripeChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids) { @@ -217,7 +217,7 @@ rf_IdentifyStripeChainDecluster(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, *diskids = info->stripeIdentifier[col]; } -void +void rf_MapSIDToPSIDChainDecluster(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, @@ -235,7 +235,7 @@ rf_MapSIDToPSIDChainDecluster(RF_RaidLayout_t *layoutPtr, * createFunc - function to use to create the graph (return value) *****************************************************************************/ -void +void rf_RAIDCDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_AccessStripeMap_t *asmap, RF_VoidFuncPtr *createFunc) #if 0 diff --git a/sys/dev/raidframe/rf_chaindecluster.h b/sys/dev/raidframe/rf_chaindecluster.h index 6807149a967..fea4992c975 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.5 2003/12/29 02:38:17 oster Exp $ */ +/* $NetBSD: rf_chaindecluster.h,v 1.6 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,24 +34,24 @@ #ifndef _RF__RF_CHAINDECLUSTER_H_ #define _RF__RF_CHAINDECLUSTER_H_ -int +int rf_ConfigureChainDecluster(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); RF_ReconUnitCount_t rf_GetNumSpareRUsChainDecluster(RF_Raid_t * raidPtr); -void +void rf_MapSectorChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeChainDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDChainDecluster(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RAIDCDagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr *); diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index 95b3eb933a5..78378c3291f 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.30 2005/02/12 03:44:41 oster Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.31 2005/02/27 00:27:44 perry 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.30 2005/02/12 03:44:41 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.31 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -68,7 +68,7 @@ static void rf_CopybackOne(RF_CopybackDesc_t * desc, int typ, RF_SectorNum_t testOffs); static void rf_CopybackComplete(RF_CopybackDesc_t * desc, int status); -int +int rf_ConfigureCopyback(listp) RF_ShutdownList_t **listp; { @@ -84,7 +84,7 @@ rf_ConfigureCopyback(listp) #include <sys/vnode.h> /* do a complete copyback */ -void +void rf_CopybackReconstructedData(RF_Raid_t *raidPtr) { RF_ComponentLabel_t c_label; @@ -142,7 +142,7 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr) if (retcode) { printf("raid%d: copyback: raidlookup on device: %s failed: %d!\n", - raidPtr->raidid, raidPtr->Disks[fcol].devname, + raidPtr->raidid, raidPtr->Disks[fcol].devname, retcode); /* XXX the component isn't responding properly... must be @@ -219,7 +219,7 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr) 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 = 0; @@ -237,7 +237,7 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr) * invoked via callback after a copyback I/O has completed to * continue on with the next one */ -void +void rf_ContinueCopyback(RF_CopybackDesc_t *desc) { RF_SectorNum_t testOffs, stripeAddr; @@ -314,7 +314,7 @@ rf_ContinueCopyback(RF_CopybackDesc_t *desc) /* copyback one unit */ -static void +static void rf_CopybackOne(RF_CopybackDesc_t *desc, int typ, RF_RaidAddr_t addr, RF_RowCol_t testCol, RF_SectorNum_t testOffs) { @@ -369,7 +369,7 @@ rf_CopybackOne(RF_CopybackDesc_t *desc, int typ, RF_RaidAddr_t addr, /* called at interrupt context when the read has completed. just send out the write */ -static int +static int rf_CopybackReadDoneProc(RF_CopybackDesc_t *desc, int status) { if (status) { /* invoke the callback with bad status */ @@ -386,7 +386,7 @@ rf_CopybackReadDoneProc(RF_CopybackDesc_t *desc, int status) * in the simulator, invoke the next copyback directly. * can't free diskqueuedata structs in the kernel b/c we're at interrupt context. */ -static int +static int rf_CopybackWriteDoneProc(RF_CopybackDesc_t *desc, int status) { if (status && status != -100) { @@ -398,7 +398,7 @@ rf_CopybackWriteDoneProc(RF_CopybackDesc_t *desc, int status) return (0); } /* invoked when the copyback has completed */ -static void +static void rf_CopybackComplete(RF_CopybackDesc_t *desc, int status) { RF_Raid_t *raidPtr = desc->raidPtr; diff --git a/sys/dev/raidframe/rf_cvscan.c b/sys/dev/raidframe/rf_cvscan.c index d65d340b88d..8a8c4a2ecb5 100644 --- a/sys/dev/raidframe/rf_cvscan.c +++ b/sys/dev/raidframe/rf_cvscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.c,v 1.11 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_cvscan.c,v 1.12 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,7 +35,7 @@ ******************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.11 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.12 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> #include "rf_alloclist.h" @@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.11 2003/12/30 21:59:03 oster Exp $") #define pri_ok(p) ( ((p) == RF_IO_NORMAL_PRIORITY) || ((p) == RF_IO_LOW_PRIORITY)) -static void +static void CheckCvscanState(RF_CvscanHeader_t *hdr) { long i, key; @@ -87,7 +87,7 @@ CheckCvscanState(RF_CvscanHeader_t *hdr) -static void +static void PriorityInsert(RF_DiskQueueData_t **list_ptr, RF_DiskQueueData_t *req) { /* * insert block pointed to by req in to list whose first * entry is @@ -104,7 +104,7 @@ PriorityInsert(RF_DiskQueueData_t **list_ptr, RF_DiskQueueData_t *req) -static void +static void ReqInsert(RF_DiskQueueData_t **list_ptr, RF_DiskQueueData_t *req, RF_CvscanArmDir_t order) { /* * insert block pointed to by req in to list whose first * entry is @@ -135,7 +135,7 @@ ReqDequeue(RF_DiskQueueData_t **list_ptr) -static void +static void ReBalance(RF_CvscanHeader_t *hdr) { /* DO_CHECK_STATE(hdr); */ @@ -150,7 +150,7 @@ ReBalance(RF_CvscanHeader_t *hdr) -static void +static void Transfer(RF_DiskQueueData_t **to_list_ptr, RF_DiskQueueData_t **from_list_ptr) { RF_DiskQueueData_t *gp; @@ -164,7 +164,7 @@ Transfer(RF_DiskQueueData_t **to_list_ptr, RF_DiskQueueData_t **from_list_ptr) -static void +static void RealEnqueue(RF_CvscanHeader_t *hdr, RF_DiskQueueData_t *req) { RF_ASSERT(req->priority == RF_IO_NORMAL_PRIORITY || req->priority == RF_IO_LOW_PRIORITY); @@ -204,7 +204,7 @@ RealEnqueue(RF_CvscanHeader_t *hdr, RF_DiskQueueData_t *req) -void +void rf_CvscanEnqueue(void *q_in, RF_DiskQueueData_t * elem, int priority) { RF_CvscanHeader_t *hdr = (RF_CvscanHeader_t *) q_in; @@ -346,7 +346,7 @@ rf_CvscanCreate(RF_SectorCount_t sectPerDisk, #if defined(__NetBSD__) && defined(_KERNEL) /* PrintCvscanQueue is not used, so we ignore it... */ #else -static void +static void PrintCvscanQueue(RF_CvscanHeader_t *hdr) { RF_DiskQueueData_t *tmp; @@ -386,8 +386,8 @@ PrintCvscanQueue(RF_CvscanHeader_t *hdr) * only have one or zero entries in the burner queue, so execution time should * be short. */ -int -rf_CvscanPromote(void *q_in, RF_StripeNum_t parityStripeID, +int +rf_CvscanPromote(void *q_in, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru) { RF_CvscanHeader_t *hdr = (RF_CvscanHeader_t *) q_in; diff --git a/sys/dev/raidframe/rf_cvscan.h b/sys/dev/raidframe/rf_cvscan.h index adcefa88888..774ea834766 100644 --- a/sys/dev/raidframe/rf_cvscan.h +++ b/sys/dev/raidframe/rf_cvscan.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.h,v 1.4 2002/09/21 00:37:14 oster Exp $ */ +/* $NetBSD: rf_cvscan.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -76,7 +76,7 @@ rf_CvscanCreate(RF_SectorCount_t sect_per_disk, void rf_CvscanEnqueue(void *qptr, RF_DiskQueueData_t * req, int priority); RF_DiskQueueData_t *rf_CvscanDequeue(void *qptr); RF_DiskQueueData_t *rf_CvscanPeek(void *qptr); -int +int rf_CvscanPromote(void *qptr, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru); diff --git a/sys/dev/raidframe/rf_dag.h b/sys/dev/raidframe/rf_dag.h index d2ebf9b7ddd..85d5314c3ee 100644 --- a/sys/dev/raidframe/rf_dag.h +++ b/sys/dev/raidframe/rf_dag.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dag.h,v 1.16 2004/04/09 23:10:17 oster Exp $ */ +/* $NetBSD: rf_dag.h,v 1.17 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -173,7 +173,7 @@ struct RF_DagHeader_s { void *cbArg; /* argument for cbFunc */ char *creator; /* name of function used to create this dag */ RF_DagNode_t *nodes; /* linked list of nodes used in this DAG */ - RF_PhysDiskAddr_t *pda_cleanup_list; /* for PDAs that can't get + RF_PhysDiskAddr_t *pda_cleanup_list; /* for PDAs that can't get cleaned up any other way... */ RF_Raid_t *raidPtr; /* the descriptor for the RAID device this DAG * is for */ diff --git a/sys/dev/raidframe/rf_dagdegrd.c b/sys/dev/raidframe/rf_dagdegrd.c index 5ce9f0ebaad..7f5b9f39ef7 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.22 2004/08/27 15:55:50 oster Exp $ */ +/* $NetBSD: rf_dagdegrd.c,v 1.23 2005/02/27 00:27:44 perry 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.22 2004/08/27 15:55:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.23 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -75,7 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.22 2004/08/27 15:55:50 oster Exp $ * the DAG creation routines to be replaced at this single point. */ -void +void rf_CreateRaidFiveDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, @@ -110,7 +110,7 @@ rf_CreateRaidFiveDegradedReadDAG(RF_Raid_t *raidPtr, * allocList - list of memory allocated in DAG creation *****************************************************************************/ -void +void rf_CreateRaidOneDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, @@ -258,7 +258,7 @@ rf_CreateRaidOneDegradedReadDAG(RF_Raid_t *raidPtr, * *****************************************************************************/ -void +void rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -573,7 +573,7 @@ rf_CreateDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * allocList - list of memory allocated in DAG creation *****************************************************************************/ -void +void rf_CreateRaidCDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -700,7 +700,7 @@ rf_CreateRaidCDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* * XXX move this elsewhere? */ -void +void rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_PhysDiskAddr_t **pdap, int *nNodep, RF_PhysDiskAddr_t **pqpdap, int *nPQNodep, @@ -821,7 +821,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* allocate up our list of pda's */ - RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t), + RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); *pdap = pda_p; @@ -1029,7 +1029,7 @@ rf_InitNode(node, rf_wait, RF_FALSE, rf_DiskReadFunc, rf_DiskReadUndoFunc, rf_Ge (_node_).params[2].v = parityStripeID; \ (_node_).params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru) -void +void rf_DoubleDegRead(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList, diff --git a/sys/dev/raidframe/rf_dagdegrd.h b/sys/dev/raidframe/rf_dagdegrd.h index ecb15f2ab4a..b1f0556c880 100644 --- a/sys/dev/raidframe/rf_dagdegrd.h +++ b/sys/dev/raidframe/rf_dagdegrd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegrd.h,v 1.5 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_dagdegrd.h,v 1.6 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,29 +32,29 @@ #include <dev/raidframe/raidframevar.h> /* degraded read DAG creation routines */ -void +void rf_CreateRaidFiveDegradedReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CreateRaidOneDegradedReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CreateDegradedReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, const RF_RedFuncs_t * recFunc); -void +void rf_CreateRaidCDegradedReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_DD_GenerateFailedAccessASMs(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_PhysDiskAddr_t ** pdap, int *nNodep, RF_PhysDiskAddr_t ** pqpdap, int *nPQNodep, RF_AllocListElem_t * allocList); -void +void rf_DoubleDegRead(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, char *redundantReadNodeName, diff --git a/sys/dev/raidframe/rf_dagdegwr.c b/sys/dev/raidframe/rf_dagdegwr.c index 66f3bcadbb6..5d0308b7140 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.24 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_dagdegwr.c,v 1.25 2005/02/27 00:27:44 perry 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.24 2004/04/09 23:10:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.25 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -75,17 +75,17 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.24 2004/04/09 23:10:16 oster Exp $ * the DAG creation routines to be replaced at this single point. */ -static +static RF_CREATE_DAG_FUNC_DECL(rf_CreateSimpleDegradedWriteDAG) { rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RecoveryXorFunc, RF_TRUE); } -void +void rf_CreateDegradedWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, - RF_DagHeader_t *dag_h, void *bp, - RF_RaidAccessFlags_t flags, + RF_DagHeader_t *dag_h, void *bp, + RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList) { @@ -151,8 +151,8 @@ rf_CreateDegradedWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * is used. *****************************************************************************/ -void -rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, +void +rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -258,7 +258,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, tmpNode->list_next = dag_h->nodes; dag_h->nodes = tmpNode; } - wndNodes = dag_h->nodes; + wndNodes = dag_h->nodes; for (i = 0; i < nRrdNodes; i++) { tmpNode = rf_AllocDAGNode(); @@ -321,7 +321,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, } } /* i now equals the number of stripe units accessed in new_asm_h[0] */ - /* Note that for tmprrdNode, this means a continuation from above, so no need to + /* Note that for tmprrdNode, this means a continuation from above, so no need to assign it anything.. */ if (new_asm_h[1]) { for (j = 0, pda = new_asm_h[1]->stripeMap->physInfo; @@ -568,7 +568,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr, pda_p->next = NULL; \ RF_MallocAndAdd(pda_p->bufPtr,rf_RaidAddressToByte(raidPtr,num),(char *), allocList) #if (RF_INCLUDE_PQ > 0) || (RF_INCLUDE_EVENODD > 0) -void +void rf_WriteGenerateFailedAccessASMs( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, @@ -650,7 +650,7 @@ rf_WriteGenerateFailedAccessASMs( /* allocate up our list of pda's */ - RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t), + RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList); *pdap = pda_p; @@ -710,7 +710,7 @@ rf_WriteGenerateFailedAccessASMs( (_node_).params[2].v = parityStripeID; \ (_node_).params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru) -void +void rf_DoubleDegSmallWrite(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -738,11 +738,11 @@ rf_DoubleDegSmallWrite(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* Hdr | ------Block- / / \ Rrd Rrd ... Rrd Rp Rq \ \ * / -------PQ----- / \ \ Wud Wp WQ \ | / * --Unblock- | T - * + * * Rrd = read recovery data (potentially none) Wud = write user data * (not incl. failed disks) Wp = Write P (could be two) Wq = Write Q * (could be two) - * + * */ rf_WriteGenerateFailedAccessASMs(raidPtr, asmap, &npdas, &nRrdNodes, &pqPDAs, &nPQNodes, allocList); diff --git a/sys/dev/raidframe/rf_dagffrd.c b/sys/dev/raidframe/rf_dagffrd.c index 1737a6c650e..fc3c95a76c7 100644 --- a/sys/dev/raidframe/rf_dagffrd.c +++ b/sys/dev/raidframe/rf_dagffrd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffrd.c,v 1.13 2004/03/18 16:40:05 oster Exp $ */ +/* $NetBSD: rf_dagffrd.c,v 1.14 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.13 2004/03/18 16:40:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.14 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.13 2004/03/18 16:40:05 oster Exp $" * the DAG creation routines to be replaced at this single point. */ -void +void rf_CreateFaultFreeReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -123,7 +123,7 @@ rf_CreateFaultFreeReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * *****************************************************************************/ -void +void rf_CreateNonredundantDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -317,10 +317,10 @@ rf_CreateNonredundantDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * allocList - list of memory allocated in DAG creation *****************************************************************************/ -static void +static void CreateMirrorReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, - RF_RaidAccessFlags_t flags, + RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList, int (*readfunc) (RF_DagNode_t * node)) { @@ -439,7 +439,7 @@ CreateMirrorReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, termNode->antType[0] = rf_control; } -void +void rf_CreateMirrorIdleReadDAG( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, @@ -454,7 +454,7 @@ rf_CreateMirrorIdleReadDAG( #if (RF_INCLUDE_CHAINDECLUSTER > 0) || (RF_INCLUDE_INTERDECLUSTER > 0) -void +void rf_CreateMirrorPartitionReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, diff --git a/sys/dev/raidframe/rf_dagffrd.h b/sys/dev/raidframe/rf_dagffrd.h index a5c0c4f81bf..df2982ded9a 100644 --- a/sys/dev/raidframe/rf_dagffrd.h +++ b/sys/dev/raidframe/rf_dagffrd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffrd.h,v 1.4 2001/10/04 15:58:52 oster Exp $ */ +/* $NetBSD: rf_dagffrd.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,19 +32,19 @@ #include <dev/raidframe/raidframevar.h> /* fault-free read DAG creation routines */ -void +void rf_CreateFaultFreeReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CreateNonredundantDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, RF_IoType_t type); -void +void rf_CreateMirrorIdleReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CreateMirrorPartitionReadDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); diff --git a/sys/dev/raidframe/rf_dagffwr.c b/sys/dev/raidframe/rf_dagffwr.c index fdd84861b40..f48032b32bd 100644 --- a/sys/dev/raidframe/rf_dagffwr.c +++ b/sys/dev/raidframe/rf_dagffwr.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffwr.c,v 1.28 2004/08/27 15:55:50 oster Exp $ */ +/* $NetBSD: rf_dagffwr.c,v 1.29 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.28 2004/08/27 15:55:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.29 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -76,7 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.28 2004/08/27 15:55:50 oster Exp $" */ -void +void rf_CreateNonRedundantWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -87,7 +87,7 @@ rf_CreateNonRedundantWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_IO_TYPE_WRITE); } -void +void rf_CreateRAID0WriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -98,25 +98,25 @@ rf_CreateRAID0WriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_IO_TYPE_WRITE); } -void +void rf_CreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList) { /* "normal" rollaway */ - rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_xorFuncs, NULL); } -void +void rf_CreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t *allocList) { /* "normal" rollaway */ - rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularXorFunc, RF_TRUE); } @@ -158,7 +158,7 @@ rf_CreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * *****************************************************************************/ -void +void rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -177,7 +177,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_PhysDiskAddr_t *pda; layoutPtr = &(raidPtr->Layout); - parityStripeID = rf_RaidAddressToParityStripeID(layoutPtr, + parityStripeID = rf_RaidAddressToParityStripeID(layoutPtr, asmap->raidAddress, &which_ru); @@ -231,8 +231,8 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) } #endif - rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, - new_asm_h, &nRodNodes, &sosBuffer, + rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, + new_asm_h, &nRodNodes, &sosBuffer, &eosBuffer, allocList); if (nRodNodes > 0) { for (i = 0; i < nRodNodes; i++) { @@ -247,20 +247,20 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* begin node initialization */ if (nRodNodes > 0) { - rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, nRodNodes, 0, 0, 0, + rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, nRodNodes, 0, 0, 0, dag_h, "Nil", allocList); } else { - rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, 1, 0, 0, 0, + rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, 1, 0, 0, 0, dag_h, "Nil", allocList); } - rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, nWndNodes + nfaults, 1, 0, 0, + rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, nWndNodes + nfaults, 1, 0, 0, dag_h, "Cmt", allocList); - rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, - rf_TerminateUndoFunc, NULL, 0, nWndNodes + nfaults, 0, 0, + rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, + rf_TerminateUndoFunc, NULL, 0, nWndNodes + nfaults, 0, 0, dag_h, "Trm", allocList); /* initialize the Rod nodes */ @@ -269,10 +269,10 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, if (new_asm_h[asmNum]) { pda = new_asm_h[asmNum]->stripeMap->physInfo; while (pda) { - rf_InitNode(tmpNode, rf_wait, + rf_InitNode(tmpNode, rf_wait, RF_FALSE, rf_DiskReadFunc, - rf_DiskReadUndoFunc, - rf_GenericWakeupFunc, + rf_DiskReadUndoFunc, + rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Rod", allocList); tmpNode->params[0].p = pda; @@ -292,9 +292,9 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, pda = asmap->physInfo; tmpNode = wndNodes; for (i = 0; i < nWndNodes; i++) { - rf_InitNode(tmpNode, rf_wait, RF_FALSE, + rf_InitNode(tmpNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, - rf_GenericWakeupFunc, 1, 1, 4, 0, + rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnd", allocList); RF_ASSERT(pda != NULL); tmpNode->params[0].p = pda; @@ -307,14 +307,14 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* initialize the redundancy node */ if (nRodNodes > 0) { - rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc, + rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc, rf_NullNodeUndoFunc, NULL, 1, - nRodNodes, 2 * (nWndNodes + nRodNodes) + 1, + nRodNodes, 2 * (nWndNodes + nRodNodes) + 1, nfaults, dag_h, "Xr ", allocList); } else { - rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc, + rf_InitNode(xorNode, rf_wait, RF_FALSE, redFunc, rf_NullNodeUndoFunc, NULL, 1, - 1, 2 * (nWndNodes + nRodNodes) + 1, + 1, 2 * (nWndNodes + nRodNodes) + 1, nfaults, dag_h, "Xr ", allocList); } xorNode->flags |= RF_DAGNODE_FLAG_YIELD; @@ -322,7 +322,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, for (i = 0; i < nWndNodes; i++) { /* pda */ xorNode->params[2 * i + 0] = tmpNode->params[0]; - /* buf ptr */ + /* buf ptr */ xorNode->params[2 * i + 1] = tmpNode->params[1]; tmpNode = tmpNode->list_next; } @@ -363,8 +363,8 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, } /* initialize the Wnp node */ - rf_InitNode(wnpNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, - rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, + rf_InitNode(wnpNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, + rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnp", allocList); wnpNode->params[0].p = asmap->parityInfo; wnpNode->params[1].p = xorNode->results[0]; @@ -384,8 +384,8 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_MallocAndAdd(xorNode->results[1], rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit), (void *), allocList); - rf_InitNode(wnqNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, - rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, + rf_InitNode(wnqNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, + rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnq", allocList); wnqNode->params[0].p = asmap->qInfo; wnqNode->params[1].p = xorNode->results[1]; @@ -516,7 +516,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * A null qfuncs indicates single fault tolerant *****************************************************************************/ -void +void rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -607,7 +607,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, dag_h->nodes = tmpNode; } readParityNodes = dag_h->nodes; - + for (i = 0; i < numDataNodes; i++) { tmpNode = rf_AllocDAGNode(); tmpNode->list_next = dag_h->nodes; @@ -667,26 +667,26 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, */ /* initialize block node (Nil) */ nNodes = numDataNodes + (nfaults * numParityNodes); - rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, nNodes, 0, 0, 0, + rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, nNodes, 0, 0, 0, dag_h, "Nil", allocList); /* initialize commit node (Cmt) */ - rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, nNodes, + rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, nNodes, (nfaults * numParityNodes), 0, 0, dag_h, "Cmt", allocList); /* initialize terminate node (Trm) */ - rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, - rf_TerminateUndoFunc, NULL, 0, nNodes, 0, 0, + rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, + rf_TerminateUndoFunc, NULL, 0, nNodes, 0, 0, dag_h, "Trm", allocList); /* initialize nodes which read old data (Rod) */ tmpreadDataNode = readDataNodes; for (i = 0; i < numDataNodes; i++) { - rf_InitNode(tmpreadDataNode, rf_wait, RF_FALSE, + rf_InitNode(tmpreadDataNode, rf_wait, RF_FALSE, rf_DiskReadFunc, rf_DiskReadUndoFunc, - rf_GenericWakeupFunc, (nfaults * numParityNodes), + rf_GenericWakeupFunc, (nfaults * numParityNodes), 1, 4, 0, dag_h, "Rod", allocList); RF_ASSERT(pda != NULL); /* physical disk addr desc */ @@ -709,9 +709,9 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpreadParityNode = readParityNodes; for (i = 0; i < numParityNodes; i++) { RF_ASSERT(pda != NULL); - rf_InitNode(tmpreadParityNode, rf_wait, RF_FALSE, + rf_InitNode(tmpreadParityNode, rf_wait, RF_FALSE, rf_DiskReadFunc, rf_DiskReadUndoFunc, - rf_GenericWakeupFunc, numParityNodes, 1, 4, 0, + rf_GenericWakeupFunc, numParityNodes, 1, 4, 0, dag_h, "Rop", allocList); tmpreadParityNode->params[0].p = pda; /* buffer to hold old parity */ @@ -733,9 +733,9 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpreadQNode = readQNodes; for (i = 0; i < numParityNodes; i++) { RF_ASSERT(pda != NULL); - rf_InitNode(tmpreadQNode, rf_wait, RF_FALSE, + rf_InitNode(tmpreadQNode, rf_wait, RF_FALSE, rf_DiskReadFunc, rf_DiskReadUndoFunc, - rf_GenericWakeupFunc, numParityNodes, + rf_GenericWakeupFunc, numParityNodes, 1, 4, 0, dag_h, "Roq", allocList); tmpreadQNode->params[0].p = pda; /* buffer to hold old Q */ @@ -757,8 +757,8 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpwriteDataNode = writeDataNodes; for (i = 0; i < numDataNodes; i++) { RF_ASSERT(pda != NULL); - rf_InitNode(tmpwriteDataNode, rf_wait, RF_FALSE, - rf_DiskWriteFunc, rf_DiskWriteUndoFunc, + rf_InitNode(tmpwriteDataNode, rf_wait, RF_FALSE, + rf_DiskWriteFunc, rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnd", allocList); /* physical disk addr desc */ @@ -784,7 +784,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * the buffer to XOR the data, whereas the simple XOR func * just XORs the data into the start of the buffer. */ if ((numParityNodes == 2) || ((numDataNodes == 1) - && (asmap->totalSectorsAccessed < + && (asmap->totalSectorsAccessed < raidPtr->Layout.sectorsPerStripeUnit))) { func = pfuncs->simple; undoFunc = rf_NullNodeUndoFunc; @@ -822,9 +822,9 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpreadQNode = readQNodes; for (i = 0; i < numParityNodes; i++) { /* note: no wakeup func for xor */ - rf_InitNode(tmpxorNode, rf_wait, RF_FALSE, func, - undoFunc, NULL, 1, - (numDataNodes + numParityNodes), + rf_InitNode(tmpxorNode, rf_wait, RF_FALSE, func, + undoFunc, NULL, 1, + (numDataNodes + numParityNodes), 7, 1, dag_h, name, allocList); tmpxorNode->flags |= RF_DAGNODE_FLAG_YIELD; tmpxorNode->params[0] = tmpreadDataNode->params[0]; @@ -839,9 +839,9 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) if (nfaults == 2) { /* note: no wakeup func for qor */ - rf_InitNode(tmpqNode, rf_wait, RF_FALSE, + rf_InitNode(tmpqNode, rf_wait, RF_FALSE, qfunc, undoFunc, NULL, 1, - (numDataNodes + numParityNodes), + (numDataNodes + numParityNodes), 7, 1, dag_h, qname, allocList); tmpqNode->params[0] = tmpreadDataNode->params[0]; tmpqNode->params[1] = tmpreadDataNode->params[1]; @@ -863,13 +863,13 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, } } else { /* there is only one xor node in this case */ - rf_InitNode(xorNodes, rf_wait, RF_FALSE, func, + rf_InitNode(xorNodes, rf_wait, RF_FALSE, func, undoFunc, NULL, 1, (numDataNodes + numParityNodes), - (2 * (numDataNodes + numDataNodes + 1) + 1), 1, + (2 * (numDataNodes + numDataNodes + 1) + 1), 1, dag_h, name, allocList); xorNodes->flags |= RF_DAGNODE_FLAG_YIELD; tmpreadDataNode = readDataNodes; - for (i = 0; i < numDataNodes; i++) { /* used to be"numDataNodes + 1" until we factored + for (i = 0; i < numDataNodes; i++) { /* used to be"numDataNodes + 1" until we factored out the "+1" into the "deal with Rop separately below */ /* set up params related to Rod nodes */ xorNodes->params[2 * i + 0] = tmpreadDataNode->params[0]; /* pda */ @@ -894,7 +894,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, xorNodes->results[0] = readParityNodes->params[1].p; #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) if (nfaults == 2) { - rf_InitNode(qNodes, rf_wait, RF_FALSE, qfunc, + rf_InitNode(qNodes, rf_wait, RF_FALSE, qfunc, undoFunc, NULL, 1, (numDataNodes + numParityNodes), (2 * (numDataNodes + numDataNodes + 1) + 1), 1, @@ -932,7 +932,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpwriteParityNode = writeParityNodes; tmpxorNode = xorNodes; for (i = 0; i < numParityNodes; i++) { - rf_InitNode(tmpwriteParityNode, rf_wait, RF_FALSE, + rf_InitNode(tmpwriteParityNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnp", allocList); @@ -957,8 +957,8 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, tmpwriteQNode = writeQNodes; tmpqNode = qNodes; for (i = 0; i < numParityNodes; i++) { - rf_InitNode(tmpwriteQNode, rf_wait, RF_FALSE, - rf_DiskWriteFunc, rf_DiskWriteUndoFunc, + rf_InitNode(tmpwriteQNode, rf_wait, RF_FALSE, + rf_DiskWriteFunc, rf_DiskWriteUndoFunc, rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnq", allocList); RF_ASSERT(pda != NULL); @@ -1189,7 +1189,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * allocList - list of memory allocated in DAG creation *****************************************************************************/ -void +void rf_CreateRaidOneWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, void *bp, RF_RaidAccessFlags_t flags, @@ -1256,14 +1256,14 @@ rf_CreateRaidOneWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, dag_h->numSuccedents = 1; /* initialize the commit, unblock, and term nodes */ - rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, (nWndNodes + nWmirNodes), + rf_InitNode(commitNode, rf_wait, RF_TRUE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, (nWndNodes + nWmirNodes), 0, 0, 0, dag_h, "Cmt", allocList); - rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, - rf_NullNodeUndoFunc, NULL, 1, (nWndNodes + nWmirNodes), + rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, + rf_NullNodeUndoFunc, NULL, 1, (nWndNodes + nWmirNodes), 0, 0, dag_h, "Nil", allocList); - rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, - rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, + rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, + rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", allocList); /* initialize the wnd nodes */ @@ -1271,9 +1271,9 @@ rf_CreateRaidOneWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, pda = asmap->physInfo; tmpwndNode = wndNode; for (i = 0; i < nWndNodes; i++) { - rf_InitNode(tmpwndNode, rf_wait, RF_FALSE, + rf_InitNode(tmpwndNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, - rf_GenericWakeupFunc, 1, 1, 4, 0, + rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wpd", allocList); RF_ASSERT(pda != NULL); tmpwndNode->params[0].p = pda; @@ -1291,9 +1291,9 @@ rf_CreateRaidOneWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, pdaP = asmap->parityInfo; tmpwmirNode = wmirNode; for (i = 0; i < nWmirNodes; i++) { - rf_InitNode(tmpwmirNode, rf_wait, RF_FALSE, + rf_InitNode(tmpwmirNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, - rf_GenericWakeupFunc, 1, 1, 4, 0, + rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wsd", allocList); RF_ASSERT(pda != NULL); tmpwmirNode->params[0].p = pdaP; diff --git a/sys/dev/raidframe/rf_dagffwr.h b/sys/dev/raidframe/rf_dagffwr.h index 70fc51c2d2f..4f4a5c10ae4 100644 --- a/sys/dev/raidframe/rf_dagffwr.h +++ b/sys/dev/raidframe/rf_dagffwr.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffwr.h,v 1.5 2003/02/09 10:04:33 jdolecek Exp $ */ +/* $NetBSD: rf_dagffwr.h,v 1.6 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,24 +32,24 @@ #include <dev/raidframe/raidframevar.h> /* fault-free write DAG creation routines */ -void +void rf_CreateNonRedundantWriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, RF_IoType_t type); -void +void rf_CreateRAID0WriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, RF_IoType_t type); -void +void rf_CreateSmallWriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CreateLargeWriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList); -void +void rf_CommonCreateLargeWriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, int nfaults, diff --git a/sys/dev/raidframe/rf_dagfuncs.c b/sys/dev/raidframe/rf_dagfuncs.c index b2bbb581549..102d31cb6c7 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.22 2005/02/12 03:44:41 oster Exp $ */ +/* $NetBSD: rf_dagfuncs.c,v 1.23 2005/02/27 00:27:44 perry 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.22 2005/02/12 03:44:41 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.23 2005/02/27 00:27:44 perry Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -84,10 +84,10 @@ int (*rf_RecoveryXorUndoFunc) (RF_DagNode_t *); /***************************************************************************** * main (only) configuration routine for this module ****************************************************************************/ -int +int rf_ConfigureDAGFuncs(RF_ShutdownList_t **listp) { - RF_ASSERT(((sizeof(long) == 8) && RF_LONGSHIFT == 3) || + RF_ASSERT(((sizeof(long) == 8) && RF_LONGSHIFT == 3) || ((sizeof(long) == 4) && RF_LONGSHIFT == 2)); rf_DiskReadFunc = rf_DiskReadFuncForThreads; rf_DiskReadUndoFunc = rf_DiskUndoFunc; @@ -106,7 +106,7 @@ rf_ConfigureDAGFuncs(RF_ShutdownList_t **listp) /***************************************************************************** * the execution function associated with a terminate node ****************************************************************************/ -int +int rf_TerminateFunc(RF_DagNode_t *node) { RF_ASSERT(node->dagHdr->numCommits == node->dagHdr->numCommitNodes); @@ -114,7 +114,7 @@ rf_TerminateFunc(RF_DagNode_t *node) return (rf_FinishNode(node, RF_THREAD_CONTEXT)); } -int +int rf_TerminateUndoFunc(RF_DagNode_t *node) { return (0); @@ -134,7 +134,7 @@ rf_TerminateUndoFunc(RF_DagNode_t *node) * ****************************************************************************/ -int +int rf_DiskReadMirrorIdleFunc(RF_DagNode_t *node) { /* select the mirror copy with the shortest queue and fill in node @@ -145,7 +145,7 @@ rf_DiskReadMirrorIdleFunc(RF_DagNode_t *node) } #if (RF_INCLUDE_CHAINDECLUSTER > 0) || (RF_INCLUDE_INTERDECLUSTER > 0) || (RF_DEBUG_VALIDATE_DAG > 0) -int +int rf_DiskReadMirrorPartitionFunc(RF_DagNode_t *node) { /* select the mirror copy with the shortest queue and fill in node @@ -156,7 +156,7 @@ rf_DiskReadMirrorPartitionFunc(RF_DagNode_t *node) } #endif -int +int rf_DiskReadMirrorUndoFunc(RF_DagNode_t *node) { return (0); @@ -168,7 +168,7 @@ rf_DiskReadMirrorUndoFunc(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with a parity log update node ****************************************************************************/ -int +int rf_ParityLogUpdateFunc(RF_DagNode_t *node) { RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p; @@ -205,7 +205,7 @@ rf_ParityLogUpdateFunc(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with a parity log overwrite node ****************************************************************************/ -int +int rf_ParityLogOverwriteFunc(RF_DagNode_t *node) { RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p; @@ -220,7 +220,7 @@ rf_ParityLogOverwriteFunc(RF_DagNode_t *node) #if RF_ACC_TRACE > 0 RF_ETIMER_START(timer); #endif - logData = rf_CreateParityLogData(RF_OVERWRITE, pda, buf, + logData = rf_CreateParityLogData(RF_OVERWRITE, pda, buf, (RF_Raid_t *) (node->dagHdr->raidPtr), node->wakeFunc, (void *) node, node->dagHdr->tracerec, timer); if (logData) @@ -237,13 +237,13 @@ rf_ParityLogOverwriteFunc(RF_DagNode_t *node) return (0); } -int +int rf_ParityLogUpdateUndoFunc(RF_DagNode_t *node) { return (0); } -int +int rf_ParityLogOverwriteUndoFunc(RF_DagNode_t *node) { return (0); @@ -253,14 +253,14 @@ rf_ParityLogOverwriteUndoFunc(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with a NOP node ****************************************************************************/ -int +int rf_NullNodeFunc(RF_DagNode_t *node) { node->status = rf_good; return (rf_FinishNode(node, RF_THREAD_CONTEXT)); } -int +int rf_NullNodeUndoFunc(RF_DagNode_t *node) { node->status = rf_undone; @@ -271,7 +271,7 @@ rf_NullNodeUndoFunc(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with a disk-read node ****************************************************************************/ -int +int rf_DiskReadFuncForThreads(RF_DagNode_t *node) { RF_DiskQueueData_t *req; @@ -310,7 +310,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with a disk-write node ****************************************************************************/ -int +int rf_DiskWriteFuncForThreads(RF_DagNode_t *node) { RF_DiskQueueData_t *req; @@ -353,7 +353,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node) * Note: this is not a proper undo of a write node, only locks are released. * old data is not restored to disk! ****************************************************************************/ -int +int rf_DiskUndoFunc(RF_DagNode_t *node) { RF_DiskQueueData_t *req; @@ -383,7 +383,7 @@ rf_DiskUndoFunc(RF_DagNode_t *node) /***************************************************************************** * the execution function associated with an "unlock disk queue" node ****************************************************************************/ -int +int rf_DiskUnlockFuncForThreads(RF_DagNode_t *node) { RF_DiskQueueData_t *req; @@ -415,7 +415,7 @@ rf_DiskUnlockFuncForThreads(RF_DagNode_t *node) * op completes, the routine is called to set the node status and * inform the execution engine that the node has fired. ****************************************************************************/ -int +int rf_GenericWakeupFunc(RF_DagNode_t *node, int status) { @@ -471,7 +471,7 @@ rf_GenericWakeupFunc(RF_DagNode_t *node, int status) * assume the result field points to a buffer that is the size of one * SU, and use the pda params to determine where within the buffer to * XOR the input buffers. */ -int +int rf_RegularXorFunc(RF_DagNode_t *node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->params[node->numParams - 1].p; @@ -503,7 +503,7 @@ rf_RegularXorFunc(RF_DagNode_t *node) * I/O in this node */ } /* xor the inputs into the result buffer, ignoring placement issues */ -int +int rf_SimpleXorFunc(RF_DagNode_t *node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->params[node->numParams - 1].p; @@ -540,7 +540,7 @@ rf_SimpleXorFunc(RF_DagNode_t *node) * sectors in the failed PDA. It then uses the other PDAs in the * parameter list to determine where within the target buffer the * corresponding data should be xored. */ -int +int rf_RecoveryXorFunc(RF_DagNode_t *node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->params[node->numParams - 1].p; @@ -590,7 +590,7 @@ rf_RecoveryXorFunc(RF_DagNode_t *node) * When the access is less than one SU in size the XOR occurs on only * the portion of targbuf identified in the pda. */ -int +int rf_XorIntoBuffer(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda, char *srcbuf, char *targbuf) { @@ -611,15 +611,15 @@ rf_XorIntoBuffer(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda, * this is the only case we optimize for. The length should always be * a multiple of the sector size, so there should be no problem with * leftover bytes at the end. */ -int +int rf_bxor(char *src, char *dest, int len) { unsigned mask = sizeof(long) - 1, retcode = 0; - if (!(((unsigned long) src) & mask) && + if (!(((unsigned long) src) & mask) && !(((unsigned long) dest) & mask) && !(len & mask)) { - retcode = rf_longword_bxor((unsigned long *) src, - (unsigned long *) dest, + retcode = rf_longword_bxor((unsigned long *) src, + (unsigned long *) dest, len >> RF_LONGSHIFT); } else { RF_ASSERT(0); @@ -632,11 +632,11 @@ rf_bxor(char *src, char *dest, int len) * about which input buffers are in kernel/user space, nor about their * alignment, so in each loop we compute the maximum number of bytes * that we can xor without crossing any page boundaries, and do only - * this many bytes before the next remap. - * - * len - is in longwords + * this many bytes before the next remap. + * + * len - is in longwords */ -int +int rf_longword_bxor(unsigned long *src, unsigned long *dest, int len) { unsigned long *end = src + len; @@ -709,7 +709,7 @@ rf_longword_bxor(unsigned long *src, unsigned long *dest, int len) see comment above longword_bxor len is length in longwords */ -int +int rf_longword_bxor3(unsigned long *dst, unsigned long *a, unsigned long *b, unsigned long *c, int len, void *bp) { @@ -869,8 +869,8 @@ rf_longword_bxor3(unsigned long *dst, unsigned long *a, unsigned long *b, return (0); } -int -rf_bxor3(unsigned char *dst, unsigned char *a, unsigned char *b, +int +rf_bxor3(unsigned char *dst, unsigned char *a, unsigned char *b, unsigned char *c, unsigned long len, void *bp) { RF_ASSERT(((RF_UL(dst) | RF_UL(a) | RF_UL(b) | RF_UL(c) | len) & 0x7) == 0); diff --git a/sys/dev/raidframe/rf_dagfuncs.h b/sys/dev/raidframe/rf_dagfuncs.h index 2126917b8a0..240d68da740 100644 --- a/sys/dev/raidframe/rf_dagfuncs.h +++ b/sys/dev/raidframe/rf_dagfuncs.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagfuncs.h,v 1.7 2004/01/10 17:04:44 oster Exp $ */ +/* $NetBSD: rf_dagfuncs.h,v 1.8 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -55,16 +55,16 @@ int rf_GenericWakeupFunc(RF_DagNode_t * node, int status); int rf_RegularXorFunc(RF_DagNode_t * node); int rf_SimpleXorFunc(RF_DagNode_t * node); int rf_RecoveryXorFunc(RF_DagNode_t * node); -int +int rf_XorIntoBuffer(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, char *srcbuf, char *targbuf); int rf_bxor(char *src, char *dest, int len); -int +int rf_longword_bxor(unsigned long *src, unsigned long *dest, int len); -int -rf_longword_bxor3(unsigned long *dest, unsigned long *a, unsigned long *b, +int +rf_longword_bxor3(unsigned long *dest, unsigned long *a, unsigned long *b, unsigned long *c, int len, void *bp); -int +int rf_bxor3(unsigned char *dst, unsigned char *a, unsigned char *b, unsigned char *c, unsigned long len, void *bp); diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c index 77b82315e59..41a6d0fe6f7 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.44 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_dagutils.c,v 1.45 2005/02/27 00:27:44 perry 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.44 2004/04/09 23:10:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.45 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -68,14 +68,14 @@ static void rf_ValidateVisitedBits(RF_DagHeader_t *); /* The maximum number of nodes in a DAG is bounded by -(2 * raidPtr->Layout->numDataCol) + (1 * layoutPtr->numParityCol) + +(2 * raidPtr->Layout->numDataCol) + (1 * layoutPtr->numParityCol) + (1 * 2 * layoutPtr->numParityCol) + 3 which is: 2*RF_MAXCOL+1*2+1*2*2+3 For RF_MAXCOL of 40, this works out to 89. We use this value to provide an estimate -on the maximum size needed for RF_DAGPCACHE_SIZE. For RF_MAXCOL of 40, this structure -would be 534 bytes. Too much to have on-hand in a RF_DagNode_t, but should be ok to +on the maximum size needed for RF_DAGPCACHE_SIZE. For RF_MAXCOL of 40, this structure +would be 534 bytes. Too much to have on-hand in a RF_DagNode_t, but should be ok to have a few kicking around. */ #define RF_DAGPCACHE_SIZE ((2*RF_MAXCOL+1*2+1*2*2+3) *(RF_MAX(sizeof(RF_DagParam_t), sizeof(RF_DagNode_t *)))) @@ -112,8 +112,8 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit, node->numAntecedents = nAnte; node->numAntDone = 0; node->next = NULL; - /* node->list_next = NULL */ /* Don't touch this here! - It may already be + /* node->list_next = NULL */ /* Don't touch this here! + It may already be in use by the caller! */ node->numSuccedents = nSucc; node->name = name; @@ -142,7 +142,7 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit, node->big_dag_ptrs = rf_AllocDAGPCache(); ptrs = (void **) node->big_dag_ptrs; } else { - RF_MallocAndAdd(ptrs, nptrs * sizeof(void *), + RF_MallocAndAdd(ptrs, nptrs * sizeof(void *), (void **), alist); } node->succedents = (nSucc) ? (RF_DagNode_t **) ptrs : NULL; @@ -157,8 +157,8 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit, node->big_dag_params = rf_AllocDAGPCache(); node->params = node->big_dag_params; } else { - RF_MallocAndAdd(node->params, - nParam * sizeof(RF_DagParam_t), + RF_MallocAndAdd(node->params, + nParam * sizeof(RF_DagParam_t), (RF_DagParam_t *), alist); } } else { @@ -174,7 +174,7 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit, * *****************************************************************************/ -void +void rf_FreeDAG(RF_DagHeader_t *dag_h) { RF_AccessStripeMapHeader_t *asmap, *t_asmap; @@ -224,7 +224,7 @@ rf_FreeDAG(RF_DagHeader_t *dag_h) #define RF_MIN_FREE_BUFFERS 32 static void rf_ShutdownDAGs(void *); -static void +static void rf_ShutdownDAGs(void *ignored) { pool_destroy(&rf_pools.dagh); @@ -234,7 +234,7 @@ rf_ShutdownDAGs(void *ignored) pool_destroy(&rf_pools.funclist); } -int +int rf_ConfigureDAGs(RF_ShutdownList_t **listp) { @@ -263,7 +263,7 @@ rf_AllocDAGHeader() return (dh); } -void +void rf_FreeDAGHeader(RF_DagHeader_t * dh) { pool_put(&rf_pools.dagh, dh); @@ -314,7 +314,7 @@ rf_AllocDAGPCache() void *p; p = pool_get(&rf_pools.dagpcache, PR_WAITOK); memset(p, 0, RF_DAGPCACHE_SIZE); - + return (p); } @@ -331,7 +331,7 @@ rf_AllocFuncList() funcList = pool_get(&rf_pools.funclist, PR_WAITOK); memset(funcList, 0, sizeof(RF_FuncList_t)); - + return (funcList); } @@ -342,7 +342,7 @@ rf_FreeFuncList(RF_FuncList_t *funcList) } /* allocates a stripe buffer -- a buffer large enough to hold all the data - in an entire stripe. + in an entire stripe. */ void * @@ -351,11 +351,11 @@ rf_AllocStripeBuffer(RF_Raid_t *raidPtr, RF_DagHeader_t *dag_h, int size) RF_VoidPointerListElem_t *vple; void *p; - RF_ASSERT((size <= (raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << + RF_ASSERT((size <= (raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << raidPtr->logBytesPerSector)))); - p = malloc( raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << - raidPtr->logBytesPerSector), + p = malloc( raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << + raidPtr->logBytesPerSector), M_RAIDFRAME, M_NOWAIT); if (!p) { RF_LOCK_MUTEX(raidPtr->mutex); @@ -372,9 +372,9 @@ rf_AllocStripeBuffer(RF_Raid_t *raidPtr, RF_DagHeader_t *dag_h, int size) } RF_UNLOCK_MUTEX(raidPtr->mutex); if (!p) { - /* We didn't get a buffer... not much we can do other than wait, + /* We didn't get a buffer... not much we can do other than wait, and hope that someone frees up memory for us.. */ - p = malloc( raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << + p = malloc( raidPtr->numCol * (raidPtr->Layout.sectorsPerStripeUnit << raidPtr->logBytesPerSector), M_RAIDFRAME, M_WAITOK); } } @@ -430,11 +430,11 @@ rf_AllocIOBuffer(RF_Raid_t *raidPtr, int size) RF_VoidPointerListElem_t *vple; void *p; - RF_ASSERT((size <= (raidPtr->Layout.sectorsPerStripeUnit << + RF_ASSERT((size <= (raidPtr->Layout.sectorsPerStripeUnit << raidPtr->logBytesPerSector))); - p = malloc( raidPtr->Layout.sectorsPerStripeUnit << - raidPtr->logBytesPerSector, + p = malloc( raidPtr->Layout.sectorsPerStripeUnit << + raidPtr->logBytesPerSector, M_RAIDFRAME, M_NOWAIT); if (!p) { RF_LOCK_MUTEX(raidPtr->mutex); @@ -451,10 +451,10 @@ rf_AllocIOBuffer(RF_Raid_t *raidPtr, int size) } RF_UNLOCK_MUTEX(raidPtr->mutex); if (!p) { - /* We didn't get a buffer... not much we can do other than wait, + /* We didn't get a buffer... not much we can do other than wait, and hope that someone frees up memory for us.. */ - p = malloc( raidPtr->Layout.sectorsPerStripeUnit << - raidPtr->logBytesPerSector, + p = malloc( raidPtr->Layout.sectorsPerStripeUnit << + raidPtr->logBytesPerSector, M_RAIDFRAME, M_WAITOK); } } @@ -504,7 +504,7 @@ rf_NodeStatusString(RF_DagNode_t *node) } } -void +void rf_PrintNodeInfoString(RF_DagNode_t *node) { RF_PhysDiskAddr_t *pda; @@ -566,7 +566,7 @@ rf_PrintNodeInfoString(RF_DagNode_t *node) printf("?\n"); } #ifdef DEBUG -static void +static void rf_RecurPrintDAG(RF_DagNode_t *node, int depth, int unvisited) { char *anttype; @@ -610,7 +610,7 @@ rf_RecurPrintDAG(RF_DagNode_t *node, int depth, int unvisited) } } -static void +static void rf_PrintDAG(RF_DagHeader_t *dag_h) { int unvisited, i; @@ -650,7 +650,7 @@ rf_PrintDAG(RF_DagHeader_t *dag_h) } #endif /* assigns node numbers */ -int +int rf_AssignNodeNums(RF_DagHeader_t * dag_h) { int unvisited, i, nnum; @@ -669,7 +669,7 @@ rf_AssignNodeNums(RF_DagHeader_t * dag_h) return (nnum); } -int +int rf_RecurAssignNodeNums(RF_DagNode_t *node, int num, int unvisited) { int i; @@ -685,7 +685,7 @@ rf_RecurAssignNodeNums(RF_DagNode_t *node, int num, int unvisited) return (num); } /* set the header pointers in each node to "newptr" */ -void +void rf_ResetDAGHeaderPointers(RF_DagHeader_t *dag_h, RF_DagHeader_t *newptr) { int i; @@ -694,7 +694,7 @@ rf_ResetDAGHeaderPointers(RF_DagHeader_t *dag_h, RF_DagHeader_t *newptr) rf_RecurResetDAGHeaderPointers(dag_h->succedents[i], newptr); } -void +void rf_RecurResetDAGHeaderPointers(RF_DagNode_t *node, RF_DagHeader_t *newptr) { int i; @@ -705,7 +705,7 @@ rf_RecurResetDAGHeaderPointers(RF_DagNode_t *node, RF_DagHeader_t *newptr) } -void +void rf_PrintDAGList(RF_DagHeader_t * dag_h) { int i = 0; @@ -717,7 +717,7 @@ rf_PrintDAGList(RF_DagHeader_t * dag_h) } } -static int +static int rf_ValidateBranch(RF_DagNode_t *node, int *scount, int *acount, RF_DagNode_t **nodes, int unvisited) { @@ -775,7 +775,7 @@ rf_ValidateBranch(RF_DagNode_t *node, int *scount, int *acount, return (retcode); } -static void +static void rf_ValidateBranchVisitedBits(RF_DagNode_t *node, int unvisited, int rl) { int i; @@ -792,7 +792,7 @@ rf_ValidateBranchVisitedBits(RF_DagNode_t *node, int unvisited, int rl) /* NOTE: never call this on a big dag, because it is exponential * in execution time */ -static void +static void rf_ValidateVisitedBits(RF_DagHeader_t *dag) { int i, unvisited; @@ -823,7 +823,7 @@ rf_ValidateVisitedBits(RF_DagHeader_t *dag) * is equal to the succedent count on that node * -- what else? */ -int +int rf_ValidateDAG(RF_DagHeader_t *dag_h) { int i, nodecount; @@ -863,7 +863,7 @@ rf_ValidateDAG(RF_DagHeader_t *dag_h) RF_Malloc(scount, nodecount * sizeof(int), (int *)); RF_Malloc(acount, nodecount * sizeof(int), (int *)); - RF_Malloc(nodes, nodecount * sizeof(RF_DagNode_t *), + RF_Malloc(nodes, nodecount * sizeof(RF_DagNode_t *), (RF_DagNode_t **)); for (i = 0; i < dag_h->numSuccedents; i++) { if ((dag_h->succedents[i]->visited == unvisited) @@ -931,7 +931,7 @@ validate_dag_bad: * *****************************************************************************/ -void +void rf_redirect_asm(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) { int ds = (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) ? 1 : 0; @@ -985,7 +985,7 @@ rf_redirect_asm(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) * Note that this routine does the wrong thing if the access is fully * contained within one stripe unit, so we RF_ASSERT against this case at the * start. - * + * * layoutPtr - in: layout information * asmap - in: access stripe map * dag_h - in: header of the dag to create @@ -993,13 +993,13 @@ rf_redirect_asm(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) * nRodNodes - out: num nodes to be generated to read unaccessed data * sosBuffer, eosBuffer - out: pointers to newly allocated buffer */ -void +void rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr, RF_RaidLayout_t *layoutPtr, RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h, RF_AccessStripeMapHeader_t **new_asm_h, - int *nRodNodes, + int *nRodNodes, char **sosBuffer, char **eosBuffer, RF_AllocListElem_t *allocList) { @@ -1046,8 +1046,8 @@ rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr, /* returns non-zero if the indicated ranges of stripe unit offsets overlap */ -int -rf_PDAOverlap(RF_RaidLayout_t *layoutPtr, +int +rf_PDAOverlap(RF_RaidLayout_t *layoutPtr, RF_PhysDiskAddr_t *src, RF_PhysDiskAddr_t *dest) { RF_SectorNum_t soffs = rf_StripeUnitOffset(layoutPtr, src->startSector); @@ -1087,7 +1087,7 @@ rf_PDAOverlap(RF_RaidLayout_t *layoutPtr, /* out: new_asm_h - the two new ASMs */ /* out: nXorBufs - the total number of xor bufs required */ /* out: rpBufPtr - a buffer for the parity read */ -void +void rf_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, RF_PhysDiskAddr_t *failedPDA, RF_DagHeader_t *dag_h, @@ -1144,9 +1144,9 @@ rf_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, } (*nXorBufs) += new_asm_h[1]->stripeMap->numStripeUnitsAccessed; } - + /* allocate a buffer for parity */ - if (rpBufPtr) + if (rpBufPtr) *rpBufPtr = rf_AllocBuffer(raidPtr, dag_h, failedPDA->numSector << raidPtr->logBytesPerSector); /* the last step is to figure out how many more distinct buffers need @@ -1206,7 +1206,7 @@ rf_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * | rrrrrrrrrrrrrrrr | * */ -void +void rf_RangeRestrictPDA(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *src, RF_PhysDiskAddr_t *dest, int dobuffer, int doraidaddr) { @@ -1245,7 +1245,7 @@ static int lowprimes[NLOWPRIMES] = {2, 3, 5, 7, 11, 13, 17, 19}; * return nonzero if access should shift to secondary, otherwise, * access is to primary *****************************************************************************/ -int +int rf_compute_workload_shift(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda) { /* @@ -1329,7 +1329,7 @@ rf_compute_workload_shift(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda) * Both the disk I/Os queued in RAIDframe as well as those at the physical * disk are counted as members of the "queue" */ -void +void rf_SelectMirrorDiskIdle(RF_DagNode_t * node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->dagHdr->raidPtr; @@ -1403,7 +1403,7 @@ rf_SelectMirrorDiskIdle(RF_DagNode_t * node) * Do simple partitioning. This assumes that * the data and parity disks are laid out identically. */ -void +void rf_SelectMirrorDiskPartition(RF_DagNode_t * node) { RF_Raid_t *raidPtr = (RF_Raid_t *) node->dagHdr->raidPtr; @@ -1424,12 +1424,12 @@ rf_SelectMirrorDiskPartition(RF_DagNode_t * node) } else if (RF_DEAD_DISK(disks[colData].status)) { usemirror = 1; - } else + } else if (raidPtr->parity_good == RF_RAID_DIRTY) { /* Trust only the main disk */ usemirror = 0; } else - if (data_pda->startSector < + if (data_pda->startSector < (disks[colData].numBlocks / 2)) { usemirror = 0; } else { diff --git a/sys/dev/raidframe/rf_dagutils.h b/sys/dev/raidframe/rf_dagutils.h index cf0739c5857..5885f327771 100644 --- a/sys/dev/raidframe/rf_dagutils.h +++ b/sys/dev/raidframe/rf_dagutils.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagutils.h,v 1.17 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_dagutils.h,v 1.18 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -60,7 +60,7 @@ void rf_InitNode(RF_DagNode_t *, RF_NodeStatus_t, int, int (*doFunc) (RF_DagNode_t *), int (*undoFunc) (RF_DagNode_t *), int (*wakeFunc) (RF_DagNode_t *, int), - int, int, int, int, RF_DagHeader_t *, + int, int, int, int, RF_DagHeader_t *, char *, RF_AllocListElem_t *); void rf_FreeDAG(RF_DagHeader_t *); @@ -102,7 +102,7 @@ void rf_MapUnaccessedPortionOfStripe(RF_Raid_t *, RF_RaidLayout_t *, char **, char **, RF_AllocListElem_t *); int rf_PDAOverlap(RF_RaidLayout_t *, RF_PhysDiskAddr_t *, RF_PhysDiskAddr_t *); void rf_GenerateFailedAccessASMs(RF_Raid_t *, RF_AccessStripeMap_t *, - RF_PhysDiskAddr_t *, RF_DagHeader_t *, + RF_PhysDiskAddr_t *, RF_DagHeader_t *, RF_AccessStripeMapHeader_t **, int *, char **, char *, RF_AllocListElem_t *); @@ -110,7 +110,7 @@ void rf_GenerateFailedAccessASMs(RF_Raid_t *, RF_AccessStripeMap_t *, #define RF_RESTRICT_NOBUFFER 0 #define RF_RESTRICT_DOBUFFER 1 -void rf_RangeRestrictPDA(RF_Raid_t *, RF_PhysDiskAddr_t *, +void rf_RangeRestrictPDA(RF_Raid_t *, RF_PhysDiskAddr_t *, RF_PhysDiskAddr_t *, int, int); int rf_compute_workload_shift(RF_Raid_t *, RF_PhysDiskAddr_t *); diff --git a/sys/dev/raidframe/rf_debugMem.c b/sys/dev/raidframe/rf_debugMem.c index 0635abd63ce..f76351cb1b2 100644 --- a/sys/dev/raidframe/rf_debugMem.c +++ b/sys/dev/raidframe/rf_debugMem.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_debugMem.c,v 1.14 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_debugMem.c,v 1.15 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.14 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.15 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -63,7 +63,7 @@ static int mh_table_initialized = 0; static void memory_hash_insert(void *addr, int size, int line, char *filen); static int memory_hash_remove(void *addr, int sz); -void +void rf_record_malloc(void *p, int size, int line, char *filen) { RF_ASSERT(size != 0); @@ -77,7 +77,7 @@ rf_record_malloc(void *p, int size, int line, char *filen) } } -void +void rf_unrecord_malloc(void *p, int sz) { int size; @@ -92,7 +92,7 @@ rf_unrecord_malloc(void *p, int sz) } } -void +void rf_print_unfreed() { int i, foundone = 0; @@ -114,7 +114,7 @@ rf_print_unfreed() } #endif /* RF_DEBUG_MEM */ -int +int rf_ConfigureDebugMem(RF_ShutdownList_t **listp) { #if RF_DEBUG_MEM @@ -134,7 +134,7 @@ rf_ConfigureDebugMem(RF_ShutdownList_t **listp) #define HASHADDR(_a_) ( (((unsigned long) _a_)>>3) % RF_MH_TABLESIZE ) -static void +static void memory_hash_insert(void *addr, int size, int line, char *filen) { unsigned long bucket = HASHADDR(addr); @@ -163,7 +163,7 @@ memory_hash_insert(void *addr, int size, int line, char *filen) p->allocated = 1; } -static int +static int memory_hash_remove(void *addr, int sz) { unsigned long bucket = HASHADDR(addr); diff --git a/sys/dev/raidframe/rf_debugprint.c b/sys/dev/raidframe/rf_debugprint.c index ce316a39c31..f470d720fcf 100644 --- a/sys/dev/raidframe/rf_debugprint.c +++ b/sys/dev/raidframe/rf_debugprint.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_debugprint.c,v 1.8 2004/01/01 19:37:17 oster Exp $ */ +/* $NetBSD: rf_debugprint.c,v 1.9 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,15 +34,15 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_debugprint.c,v 1.8 2004/01/01 19:37:17 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_debugprint.c,v 1.9 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> #include "rf_debugprint.h" #include "rf_general.h" -void -rf_debug_printf(char *s, void *a1, void *a2, void *a3, void *a4, +void +rf_debug_printf(char *s, void *a1, void *a2, void *a3, void *a4, void *a5, void *a6, void *a7, void *a8) { printf(s, a1, a2, a3, a4, a5, a6, a7, a8); diff --git a/sys/dev/raidframe/rf_debugprint.h b/sys/dev/raidframe/rf_debugprint.h index 656e56f880b..11324b83478 100644 --- a/sys/dev/raidframe/rf_debugprint.h +++ b/sys/dev/raidframe/rf_debugprint.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_debugprint.h,v 1.4 2002/08/04 03:22:07 oster Exp $ */ +/* $NetBSD: rf_debugprint.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * rf_debugprint.h */ @@ -32,7 +32,7 @@ #ifndef _RF__RF_DEBUGPRINT_H_ #define _RF__RF_DEBUGPRINT_H_ -void +void rf_debug_printf(char *s, void *a1, void *a2, void *a3, void *a4, void *a5, void *a6, void *a7, void *a8); diff --git a/sys/dev/raidframe/rf_decluster.c b/sys/dev/raidframe/rf_decluster.c index 63ad061b44a..672108c1f25 100644 --- a/sys/dev/raidframe/rf_decluster.c +++ b/sys/dev/raidframe/rf_decluster.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_decluster.c,v 1.16 2004/02/29 04:03:50 oster Exp $ */ +/* $NetBSD: rf_decluster.c,v 1.17 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ *--------------------------------------------------------------------*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.16 2004/02/29 04:03:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.17 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -66,7 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.16 2004/02/29 04:03:50 oster Exp /* configuration code */ -int +int rf_ConfigureDeclustered(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -287,7 +287,7 @@ rf_ConfigureDeclustered(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, } /* declustering with distributed sparing */ static void rf_ShutdownDeclusteredDS(RF_ThreadArg_t); -static void +static void rf_ShutdownDeclusteredDS(RF_ThreadArg_t arg) { RF_DeclusteredConfigInfo_t *info; @@ -299,7 +299,7 @@ rf_ShutdownDeclusteredDS(RF_ThreadArg_t arg) rf_FreeSpareTable(raidPtr); } -int +int rf_ConfigureDeclusteredDS(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -313,9 +313,9 @@ rf_ConfigureDeclusteredDS(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -void +void rf_MapSectorDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, - RF_RowCol_t *row, RF_RowCol_t *col, + RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout); @@ -378,7 +378,7 @@ rf_MapSectorDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, /* prototyping this inexplicably causes the compile of the layout table (rf_layout.c) to fail */ -void +void rf_MapParityDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -446,7 +446,7 @@ rf_MapParityDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, /* returns an array of ints identifying the disks that comprise the stripe containing the indicated address. * the caller must _never_ attempt to modify this array. */ -void +void rf_IdentifyStripeDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids, RF_RowCol_t *outRow) { @@ -492,7 +492,7 @@ rf_IdentifyStripeDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, * If numBufsToAccumulate is not 1, we need to limit the head sep further * because multiple bufs will be required for each stripe under recon. */ -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitDeclustered(RF_Raid_t *raidPtr) { RF_DeclusteredConfigInfo_t *info = (RF_DeclusteredConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; @@ -504,7 +504,7 @@ rf_GetDefaultHeadSepLimitDeclustered(RF_Raid_t *raidPtr) * for a reasonably large head-sep limit, but small enough that you * don't use up all your system memory with buffers. */ -int +int rf_GetDefaultNumFloatingReconBuffersDeclustered(RF_Raid_t * raidPtr) { return (100 * rf_numBufsToAccumulate); @@ -525,7 +525,7 @@ rf_GetDefaultNumFloatingReconBuffersDeclustered(RF_Raid_t * raidPtr) * the users stripe unit number from an offset into the array to * an offset into the last fulltable. */ -void +void rf_decluster_adjust_params(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t *SUID, RF_StripeCount_t *sus_per_fulltable, @@ -553,7 +553,7 @@ rf_decluster_adjust_params(RF_RaidLayout_t *layoutPtr, * map a stripe ID to a parity stripe ID. * See comment above RaidAddressToParityStripeID in layout.c. */ -void +void rf_MapSIDToPSIDDeclustered(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, @@ -573,7 +573,7 @@ rf_MapSIDToPSIDDeclustered(RF_RaidLayout_t *layoutPtr, * Called from MapSector and MapParity to retarget an access at the spare unit. * Modifies the "col" and "outSU" parameters only. */ -void +void rf_remap_to_spare_space(RF_RaidLayout_t *layoutPtr, RF_DeclusteredConfigInfo_t *info, RF_RowCol_t row, @@ -624,7 +624,7 @@ rf_remap_to_spare_space(RF_RaidLayout_t *layoutPtr, #endif /* (RF_INCLUDE_PARITY_DECLUSTERING > 0) || (RF_INCLUDE_PARITY_DECLUSTERING_PQ > 0) */ #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0) -int +int rf_InstallSpareTable(RF_Raid_t *raidPtr, RF_RowCol_t frow, RF_RowCol_t fcol) { RF_DeclusteredConfigInfo_t *info = (RF_DeclusteredConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; @@ -651,7 +651,7 @@ rf_InstallSpareTable(RF_Raid_t *raidPtr, RF_RowCol_t frow, RF_RowCol_t fcol) /* * Invoked via ioctl to install a spare table in the kernel. */ -int +int rf_SetSpareTable(RF_Raid_t *raidPtr, void *data) { RF_DeclusteredConfigInfo_t *info = (RF_DeclusteredConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; @@ -687,7 +687,7 @@ rf_SetSpareTable(RF_Raid_t *raidPtr, void *data) return (0); } -RF_ReconUnitCount_t +RF_ReconUnitCount_t rf_GetNumSpareRUsDeclustered(RF_Raid_t *raidPtr) { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -696,7 +696,7 @@ rf_GetNumSpareRUsDeclustered(RF_Raid_t *raidPtr) } #endif /* (RF_INCLUDE_PARITY_DECLUSTERING > 0) || (RF_INCLUDE_PARITY_DECLUSTERING_PQ > 0) */ -void +void rf_FreeSpareTable(RF_Raid_t *raidPtr) { long i; diff --git a/sys/dev/raidframe/rf_decluster.h b/sys/dev/raidframe/rf_decluster.h index 11ef73823c7..afda37b28d6 100644 --- a/sys/dev/raidframe/rf_decluster.h +++ b/sys/dev/raidframe/rf_decluster.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_decluster.h,v 1.4 2001/10/04 15:58:52 oster Exp $ */ +/* $NetBSD: rf_decluster.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -92,23 +92,23 @@ struct RF_DeclusteredConfigInfo_s { * kernel */ }; -int +int rf_ConfigureDeclustered(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); -int +int rf_ConfigureDeclusteredDS(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); -void +void rf_MapSectorDeclustered(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityDeclustered(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeDeclustered(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids, RF_RowCol_t * outRow); -void +void rf_MapSIDToPSIDDeclustered(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); @@ -118,11 +118,11 @@ void rf_FreeSpareTable(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitDeclustered(RF_Raid_t * raidPtr); int rf_GetDefaultNumFloatingReconBuffersDeclustered(RF_Raid_t * raidPtr); -void +void rf_decluster_adjust_params(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t * SUID, RF_StripeCount_t * sus_per_fulltable, RF_StripeCount_t * fulltable_depth, RF_StripeNum_t * base_suid); -void +void rf_remap_to_spare_space( RF_RaidLayout_t * layoutPtr, RF_DeclusteredConfigInfo_t * info, RF_RowCol_t row, RF_StripeNum_t FullTableID, diff --git a/sys/dev/raidframe/rf_declusterPQ.c b/sys/dev/raidframe/rf_declusterPQ.c index 8af6961583e..9c14ede0ca6 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.10 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_declusterPQ.c,v 1.11 2005/02/27 00:27:44 perry 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.10 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.11 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.10 2003/12/30 21:59:03 oster Ex #if (RF_INCLUDE_PARITY_DECLUSTERING_PQ > 0) || (RF_INCLUDE_EVENODD > 0) /* configuration code */ -int +int rf_ConfigureDeclusteredPQ(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -265,7 +265,7 @@ rf_ConfigureDeclusteredPQ(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -int +int rf_GetDefaultNumFloatingReconBuffersPQ(RF_Raid_t *raidPtr) { int def_decl; @@ -274,7 +274,7 @@ rf_GetDefaultNumFloatingReconBuffersPQ(RF_Raid_t *raidPtr) return (RF_MAX(3 * raidPtr->numCol, def_decl)); } -void +void rf_MapSectorDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -342,7 +342,7 @@ rf_MapSectorDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, } -void +void rf_MapParityDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -394,7 +394,7 @@ rf_MapParityDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, *diskSector = outSU * layoutPtr->sectorsPerStripeUnit + (raidSector % layoutPtr->sectorsPerStripeUnit); } -void +void rf_MapQDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) @@ -449,7 +449,7 @@ rf_MapQDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, /* returns an array of ints identifying the disks that comprise the stripe containing the indicated address. * the caller must _never_ attempt to modify this array. */ -void +void rf_IdentifyStripeDeclusteredPQ(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids, RF_RowCol_t *outRow) { diff --git a/sys/dev/raidframe/rf_declusterPQ.h b/sys/dev/raidframe/rf_declusterPQ.h index 7f606fde249..3ec963d63d6 100644 --- a/sys/dev/raidframe/rf_declusterPQ.h +++ b/sys/dev/raidframe/rf_declusterPQ.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_declusterPQ.h,v 1.4 2001/10/04 15:58:52 oster Exp $ */ +/* $NetBSD: rf_declusterPQ.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,20 +31,20 @@ #include <dev/raidframe/raidframevar.h> -int +int rf_ConfigureDeclusteredPQ(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersPQ(RF_Raid_t * raidPtr); -void +void rf_MapSectorDeclusteredPQ(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityDeclusteredPQ(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapQDeclusteredPQ(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeDeclusteredPQ(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids, RF_RowCol_t * outRow); diff --git a/sys/dev/raidframe/rf_desc.h b/sys/dev/raidframe/rf_desc.h index 06c177e78f2..a1141bedb97 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.17 2005/02/13 20:27:48 oster Exp $ */ +/* $NetBSD: rf_desc.h,v 1.18 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -78,9 +78,9 @@ struct RF_RaidAccessDesc_s { int status; /* pass/fail status of the last operation */ int numRetries; /* number of times this IO has been attempted */ RF_DagList_t *dagList; /* list of dag lists, one list per stripe */ - RF_VoidPointerListElem_t *iobufs; /* iobufs that need to be cleaned + RF_VoidPointerListElem_t *iobufs; /* iobufs that need to be cleaned up at the end of this IO */ - RF_VoidPointerListElem_t *stripebufs; /* stripe buffers that need to + RF_VoidPointerListElem_t *stripebufs; /* stripe buffers that need to be cleaned up at the end of this IO */ RF_AccessStripeMapHeader_t *asmap; /* the asm for this I/O */ diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c index f6c4ed51765..ef2a8f10222 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.39 2005/02/12 03:44:41 oster Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.40 2005/02/27 00:27:44 perry 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.39 2005/02/12 03:44:41 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.40 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -154,7 +154,7 @@ static const RF_DiskQueueSW_t diskqueuesw[] = { /* configures a single disk queue */ -int +int rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue, RF_RowCol_t c, const RF_DiskQueueSW_t *p, RF_SectorCount_t sectPerDisk, dev_t dev, @@ -178,7 +178,7 @@ rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue, return (0); } -static void +static void rf_ShutdownDiskQueueSystem(void *ignored) { pool_destroy(&rf_pools.dqd); @@ -195,7 +195,7 @@ rf_ConfigureDiskQueueSystem(RF_ShutdownList_t **listp) return (0); } -int +int rf_ConfigureDiskQueues(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -218,9 +218,9 @@ rf_ConfigureDiskQueues(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, } raidPtr->qType = p; - RF_MallocAndAdd(diskQueues, + RF_MallocAndAdd(diskQueues, (raidPtr->numCol + RF_MAXSPARE) * - sizeof(RF_DiskQueue_t), (RF_DiskQueue_t *), + sizeof(RF_DiskQueue_t), (RF_DiskQueue_t *), raidPtr->cleanupList); if (diskQueues == NULL) return (ENOMEM); @@ -229,9 +229,9 @@ rf_ConfigureDiskQueues(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, for (c = 0; c < raidPtr->numCol; c++) { rc = rf_ConfigureDiskQueue(raidPtr, &diskQueues[c], c, p, - raidPtr->sectorsPerDisk, + raidPtr->sectorsPerDisk, raidPtr->Disks[c].dev, - cfgPtr->maxOutstandingDiskReqs, + cfgPtr->maxOutstandingDiskReqs, listp, raidPtr->cleanupList); if (rc) return (rc); @@ -279,7 +279,7 @@ rf_ConfigureDiskQueues(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, * simulator rules: * Do the same as at user level, with the sleeps and wakeups suppressed. */ -void +void rf_DiskIOEnqueue(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req, int pri) { RF_ETIMER_START(req->qtime); @@ -336,7 +336,7 @@ rf_DiskIOEnqueue(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req, int pri) /* get the next set of I/Os started, kernel version only */ -void +void rf_DiskIOComplete(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req, int status) { int done = 0; @@ -424,7 +424,7 @@ rf_DiskIOComplete(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req, int status) * need not implement it. If there is no promotion routine associated with * a queue, this routine does nothing and returns -1. */ -int +int rf_DiskIOPromote(RF_DiskQueue_t *queue, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru) { @@ -458,7 +458,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect, memset(p, 0, sizeof(RF_DiskQueueData_t)); /* Need to be at splbio to access bufpool! */ s = splbio(); - p->bp = pool_get(&bufpool, waitflag); + p->bp = pool_get(&bufpool, waitflag); splx(s); if (p->bp == NULL) { /* no memory for the buffer!?!? */ @@ -484,12 +484,12 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect, return (p); } -void +void rf_FreeDiskQueueData(RF_DiskQueueData_t *p) { int s; - s = splbio(); + s = splbio(); pool_put(&bufpool, p->bp); splx(s); pool_put(&rf_pools.dqd, p); diff --git a/sys/dev/raidframe/rf_diskqueue.h b/sys/dev/raidframe/rf_diskqueue.h index cc6299518eb..c593915c5cb 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.19 2005/02/12 03:44:41 oster Exp $ */ +/* $NetBSD: rf_diskqueue.h,v 1.20 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -78,8 +78,8 @@ struct RF_DiskQueueData_s { * the driver for this I/O */ struct buf *bp; /* a bp to use to get this I/O done */ /* TAILQ bits for a queue for completed I/O requests */ - TAILQ_ENTRY(RF_DiskQueueData_s) iodone_entries; - int error; /* Indicate if an error occurred + TAILQ_ENTRY(RF_DiskQueueData_s) iodone_entries; + int error; /* Indicate if an error occurred on this I/O (1=yes, 0=no) */ }; #define RF_LOCK_DISK_QUEUE 0x01 @@ -159,12 +159,12 @@ RF_DiskQueueData_t *rf_CreateDiskQueueData(RF_IoType_t, RF_SectorNum_t, int (*wakeF) (void *, int), void *, RF_AccTraceEntry_t *, RF_Raid_t *, - RF_DiskQueueDataFlags_t, + RF_DiskQueueDataFlags_t, void *, int); void rf_FreeDiskQueueData(RF_DiskQueueData_t *); int rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *, RF_RowCol_t, const RF_DiskQueueSW_t *, - RF_SectorCount_t, dev_t, int, + RF_SectorCount_t, dev_t, int, RF_ShutdownList_t **, RF_AllocListElem_t *); diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 16e0c271070..4f59d826b0e 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.56 2004/10/10 11:15:22 tron Exp $ */ +/* $NetBSD: rf_disks.c,v 1.57 2005/02/27 00:27:44 perry 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.56 2004/10/10 11:15:22 tron Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.57 2005/02/27 00:27:44 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -87,9 +87,9 @@ __KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.56 2004/10/10 11:15:22 tron 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, 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 *, +static int rf_check_label_vitals( RF_Raid_t *, int, int, char *, RF_ComponentLabel_t *, int, int ); #define DPRINTF6(a,b,c,d,e,f) if (rf_diskDebug) printf(a,b,c,d,e,f) @@ -99,17 +99,17 @@ static int rf_check_label_vitals( RF_Raid_t *, int, int, char *, * * initialize the disks comprising the array * - * We want the spare disks to have regular row,col numbers so that we can - * easily substitue a spare for a failed disk. But, the driver code assumes - * throughout that the array contains numRow by numCol _non-spare_ disks, so + * We want the spare disks to have regular row,col numbers so that we can + * easily substitue a spare for a failed disk. But, the driver code assumes + * throughout that the array contains numRow by numCol _non-spare_ disks, so * it's not clear how to fit in the spares. This is an unfortunate holdover - * from raidSim. The quick and dirty fix is to make row zero bigger than the - * rest, and put all the spares in it. This probably needs to get changed + * from raidSim. The quick and dirty fix is to make row zero bigger than the + * rest, and put all the spares in it. This probably needs to get changed * eventually. * **************************************************************************/ -int +int rf_ConfigureDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -130,13 +130,13 @@ rf_ConfigureDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, numFailuresThisRow = 0; for (c = 0; c < raidPtr->numCol; c++) { - ret = rf_ConfigureDisk(raidPtr, + 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, @@ -196,7 +196,7 @@ rf_ConfigureDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, } else { ret = EINVAL; goto fail; - } + } } for (c = 0; c < raidPtr->numCol; c++) { @@ -221,7 +221,7 @@ rf_ConfigureDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); fail: - + rf_UnconfigureVnodes( raidPtr ); return (ret); @@ -233,7 +233,7 @@ fail: * recall from the above comment that the spare disk descriptors are stored * in row zero, which is specially expanded to hold them. ****************************************************************************/ -int +int rf_ConfigureSpareDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -254,7 +254,7 @@ rf_ConfigureSpareDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, if (ret) goto fail; if (disks[i].status != rf_ds_optimal) { - RF_ERRORMSG1("Warning: spare disk %s failed TUR\n", + RF_ERRORMSG1("Warning: spare disk %s failed TUR\n", &cfgPtr->spare_names[i][0]); } else { disks[i].status = rf_ds_spare; /* change status to @@ -262,7 +262,7 @@ rf_ConfigureSpareDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, DPRINTF6("Spare Disk %d: dev %s numBlocks %ld blockSize %d (%ld MB)\n", i, disks[i].devname, (long int) disks[i].numBlocks, disks[i].blockSize, - (long int) disks[i].numBlocks * + (long int) disks[i].numBlocks * disks[i].blockSize / 1024 / 1024); } num_spares_done++; @@ -278,7 +278,7 @@ rf_ConfigureSpareDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, } if (disks[i].numBlocks < raidPtr->sectorsPerDisk) { RF_ERRORMSG3("Spare disk %s (%d blocks) is too small to serve as a spare (need %ld blocks)\n", - disks[i].devname, disks[i].blockSize, + disks[i].devname, disks[i].blockSize, (long int) raidPtr->sectorsPerDisk); ret = EINVAL; goto fail; @@ -298,19 +298,19 @@ rf_ConfigureSpareDisks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, fail: /* Release the hold on the main components. We've failed to allocate - * a spare, and since we're failing, we need to free things.. - - XXX failing to allocate a spare is *not* that big of a deal... + * a spare, and since we're failing, we need to free things.. + + XXX failing to allocate a spare is *not* that big of a deal... We *can* survive without it, if need be, esp. if we get hot - adding working. + adding working. - If we don't fail out here, then we need a way to remove this spare... - that should be easier to do here than if we are "live"... + If we don't fail out here, then we need a way to remove this spare... + that should be easier to do here than if we are "live"... */ rf_UnconfigureVnodes( raidPtr ); - + return (ret); } @@ -322,7 +322,7 @@ rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) /* We allocate RF_MAXSPARE on the first row so that we have room to do hot-swapping of spares */ RF_MallocAndAdd(raidPtr->Disks, (raidPtr->numCol + RF_MAXSPARE) * - sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *), + sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *), raidPtr->cleanupList); if (raidPtr->Disks == NULL) { ret = ENOMEM; @@ -331,7 +331,7 @@ rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) /* get space for device specific stuff.. */ RF_MallocAndAdd(raidPtr->raid_cinfo, - (raidPtr->numCol + RF_MAXSPARE) * + (raidPtr->numCol + RF_MAXSPARE) * sizeof(struct raidcinfo), (struct raidcinfo *), raidPtr->cleanupList); @@ -341,7 +341,7 @@ rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) } return(0); -fail: +fail: rf_UnconfigureVnodes( raidPtr ); return(ret); @@ -355,7 +355,7 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, { RF_RaidDisk_t *disks; RF_RaidDisk_t *diskPtr; - RF_RowCol_t c; + RF_RowCol_t c; RF_SectorCount_t min_numblks = (RF_SectorCount_t) 0x7FFFFFFFFFFFLL; int bs, ret; int numFailuresThisRow; @@ -399,7 +399,7 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, 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 in autoconfig\n",c); @@ -420,18 +420,18 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, 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) + marked as failed once the set configures) */ ac = auto_config; @@ -441,15 +441,15 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, goto fail; } if (ac->clabel->column == c) { - /* it's this one... - flag it as 'used', so we + /* 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\n", ac->devname,c); #endif - + break; } ac=ac->next; @@ -462,40 +462,40 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, /* Found it. Configure it.. */ diskPtr->blockSize = ac->clabel->blockSize; diskPtr->numBlocks = ac->clabel->numBlocks; - /* Note: rf_protectedSectors is already + /* 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)); snprintf(diskPtr->devname, sizeof(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; - - /* + + /* * 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 + * speeds up the parity scan */ - - diskPtr->numBlocks = diskPtr->numBlocks * + + diskPtr->numBlocks = diskPtr->numBlocks * rf_sizePercentage / 100; - - /* XXX these will get set multiple times, + + /* 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 */ @@ -532,7 +532,7 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, raidPtr->status = rf_rs_degraded; raidPtr->numFailures = numFailuresThisRow; } - + /* close the device for the ones that didn't get used */ ac = auto_config; @@ -542,7 +542,7 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, VOP_CLOSE(ac->vp, FREAD | FWRITE, NOCRED, 0); vput(ac->vp); ac->vp = NULL; -#if DEBUG +#if DEBUG printf("Released %s from auto-config set.\n", ac->devname); #endif @@ -561,7 +561,7 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, return (0); fail: - + rf_UnconfigureVnodes( raidPtr ); return (ret); @@ -569,7 +569,7 @@ fail: } /* configure a single disk in the array */ -int +int rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr, RF_RowCol_t col) { @@ -622,23 +622,23 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr, if (error) { return (error); } - + diskPtr->blockSize = dpart.disklab->d_secsize; - + diskPtr->numBlocks = dpart.part->p_size - rf_protectedSectors; diskPtr->partitionSize = dpart.part->p_size; 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; diskPtr->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 */ - diskPtr->numBlocks = diskPtr->numBlocks * + diskPtr->numBlocks = diskPtr->numBlocks * rf_sizePercentage / 100; } return (0); @@ -649,10 +649,10 @@ rf_print_label_status(RF_Raid_t *raidPtr, int column, char *dev_name, RF_ComponentLabel_t *ci_label) { - printf("raid%d: Component %s being configured at col: %d\n", + 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->column, ci_label->num_columns); printf(" Version: %d Serial Number: %d Mod Counter: %d\n", ci_label->version, ci_label->serial_number, @@ -668,7 +668,7 @@ static int rf_check_label_vitals(RF_Raid_t *raidPtr, int row, int column, int fatal_error = 0; if (serial_number != ci_label->serial_number) { - printf("%s has a different serial number: %d %d\n", + printf("%s has a different serial number: %d %d\n", dev_name, serial_number, ci_label->serial_number); fatal_error = 1; } @@ -676,9 +676,9 @@ static int rf_check_label_vitals(RF_Raid_t *raidPtr, int row, int column, printf("%s has a different modfication count: %d %d\n", dev_name, mod_counter, ci_label->mod_counter); } - + if (row != ci_label->row) { - printf("Row out of alignment for: %s\n", dev_name); + printf("Row out of alignment for: %s\n", dev_name); fatal_error = 1; } if (column != ci_label->column) { @@ -697,14 +697,14 @@ static int rf_check_label_vitals(RF_Raid_t *raidPtr, int row, int column, } -/* +/* rf_CheckLabels() - check all the component labels for consistency. Return an error if there is anything major amiss. */ -int +int rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { int c; @@ -730,18 +730,18 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) too_fatal = 0; force = cfgPtr->force; - /* - We're going to try to be a little intelligent here. If one + /* + We're going to try to be a little intelligent here. If one component's label is bogus, and we can identify that it's the *only* one that's gone, we'll mark it as "failed" and allow the configuration to proceed. This will be the *only* case that we'll proceed if there would be (otherwise) fatal errors. - + Basically we simply keep a count of how many components had what serial number. If all but one agree, we simply mark - the disagreeing component as being failed, and allow + the disagreeing component as being failed, and allow things to come up "normally". - + We do this first for serial numbers, and then for "mod_counter". */ @@ -802,7 +802,7 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) /* Locate the maverick component */ if (ser_count[1] > ser_count[0]) { serial_number = ser_values[1]; - } + } for (c = 0; c < raidPtr->numCol; c++) { ci_label = &raidPtr->raid_cinfo[c].ci_label; @@ -826,15 +826,15 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) too_fatal = 1; } if (cfgPtr->parityConfig == '0') { - /* We've identified two different serial numbers. + /* We've identified two different serial numbers. RAID 0 can't cope with that, so we'll punt */ too_fatal = 1; } - } + } /* record the serial number for later. If we bail later, setting - this doesn't matter, otherwise we've got the best guess at the + this doesn't matter, otherwise we've got the best guess at the correct serial number */ raidPtr->serial_number = serial_number; @@ -848,15 +848,15 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) mod_number = mod_values[0]; } else { /* counts of different modification values - are the same. Assume greater value is - the correct one, all other things + are the same. Assume greater value is + the correct one, all other things considered */ if (mod_values[0] > mod_values[1]) { mod_number = mod_values[0]; } else { mod_number = mod_values[1]; } - + } for (c = 0; c < raidPtr->numCol; c++) { @@ -895,7 +895,7 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) RAID 0 can't cope with that, so we'll punt */ too_fatal = 1; } - } + } raidPtr->mod_counter = mod_number; @@ -909,13 +909,13 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) } if (num_ser > 2) { - printf("raid%d: Too many different serial numbers!\n", + printf("raid%d: Too many different serial numbers!\n", raidPtr->raidid); fatal_error = 1; } if (num_mod > 2) { - printf("raid%d: Too many different mod counters!\n", + printf("raid%d: Too many different mod counters!\n", raidPtr->raidid); fatal_error = 1; } @@ -928,15 +928,15 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) 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 { + } else { rf_print_label_status( raidPtr, c, dev_name, ci_label); - if (rf_check_label_vitals( raidPtr, 0, c, + if (rf_check_label_vitals( raidPtr, 0, c, dev_name, ci_label, - serial_number, + serial_number, mod_number )) { fatal_error = 1; } @@ -945,7 +945,7 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) } } } - + if (fatal_error) { parity_good = RF_RAID_DIRTY; } @@ -953,7 +953,7 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) /* we note the state of the parity */ raidPtr->parity_good = parity_good; - return(fatal_error); + return(fatal_error); } int @@ -992,7 +992,7 @@ rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr) if (ret) goto fail; if (disks[spare_number].status != rf_ds_optimal) { - RF_ERRORMSG1("Warning: spare disk %s failed TUR\n", + RF_ERRORMSG1("Warning: spare disk %s failed TUR\n", sparePtr->component_name); rf_close_component(raidPtr, raidPtr->raid_cinfo[raidPtr->numCol+spare_number].ci_vp, 0); ret=EINVAL; @@ -1001,12 +1001,12 @@ rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr) disks[spare_number].status = rf_ds_spare; DPRINTF6("Spare Disk %d: dev %s numBlocks %ld blockSize %d (%ld MB)\n", spare_number, disks[spare_number].devname, - (long int) disks[spare_number].numBlocks, + (long int) disks[spare_number].numBlocks, disks[spare_number].blockSize, - (long int) disks[spare_number].numBlocks * + (long int) disks[spare_number].numBlocks * disks[spare_number].blockSize / 1024 / 1024); } - + /* check sizes and block sizes on the spare disk */ bs = 1 << raidPtr->logBytesPerSector; @@ -1018,35 +1018,35 @@ rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr) } if (disks[spare_number].numBlocks < raidPtr->sectorsPerDisk) { RF_ERRORMSG3("Spare disk %s (%d blocks) is too small to serve as a spare (need %ld blocks)\n", - disks[spare_number].devname, - disks[spare_number].blockSize, + disks[spare_number].devname, + disks[spare_number].blockSize, (long int) raidPtr->sectorsPerDisk); rf_close_component(raidPtr, raidPtr->raid_cinfo[raidPtr->numCol+spare_number].ci_vp, 0); ret = EINVAL; goto fail; } else { - if (disks[spare_number].numBlocks > + if (disks[spare_number].numBlocks > raidPtr->sectorsPerDisk) { RF_ERRORMSG3("Warning: truncating spare disk %s to %ld blocks (from %ld)\n", - disks[spare_number].devname, + disks[spare_number].devname, (long int) raidPtr->sectorsPerDisk, (long int) disks[spare_number].numBlocks); - + disks[spare_number].numBlocks = raidPtr->sectorsPerDisk; } } spareQueues = &raidPtr->Queues[raidPtr->numCol]; ret = rf_ConfigureDiskQueue( raidPtr, &spareQueues[spare_number], - raidPtr->numCol + spare_number, + raidPtr->numCol + spare_number, raidPtr->qType, raidPtr->sectorsPerDisk, - raidPtr->Disks[raidPtr->numCol + + raidPtr->Disks[raidPtr->numCol + spare_number].dev, raidPtr->maxOutstanding, &raidPtr->shutdownList, raidPtr->cleanupList); - + RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->numSpare++; RF_UNLOCK_MUTEX(raidPtr->mutex); @@ -1098,7 +1098,7 @@ rf_delete_component(RF_Raid_t *raidPtr, RF_SingleComponent_t *component) { RF_RaidDisk_t *disks; - if ((component->column < 0) || + if ((component->column < 0) || (component->column >= raidPtr->numCol)) { return(EINVAL); } @@ -1114,7 +1114,7 @@ int rf_incorporate_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *component) { - /* Issues here include how to 'move' this in if there is IO + /* Issues here include how to 'move' this in if there is IO taking place (e.g. component queues and such) */ return(EINVAL); /* Not implemented yet. */ diff --git a/sys/dev/raidframe/rf_disks.h b/sys/dev/raidframe/rf_disks.h index a1c7c03baaa..9876f368b28 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.11 2003/12/29 02:38:17 oster Exp $ */ +/* $NetBSD: rf_disks.h,v 1.12 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -56,7 +56,7 @@ int rf_CheckLabels( RF_Raid_t *, RF_Config_t *); int rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr); int rf_remove_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr); int rf_delete_component(RF_Raid_t *raidPtr, RF_SingleComponent_t *component); -int rf_incorporate_hot_spare(RF_Raid_t *raidPtr, +int rf_incorporate_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *component); #endif /* !_RF__RF_DISKS_H_ */ diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 42d9c0217eb..cb6521e3088 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.106 2005/02/13 20:27:48 oster Exp $ */ +/* $NetBSD: rf_driver.c,v 1.107 2005/02/27 00:27:44 perry 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.106 2005/02/13 20:27:48 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.107 2005/02/27 00:27:44 perry Exp $"); #include "opt_raid_diagnostic.h" @@ -159,7 +159,7 @@ static int rf_AllocEmergBuffers(RF_Raid_t *); static void rf_FreeEmergBuffers(RF_Raid_t *); /* called at system boot time */ -int +int rf_BootRaidframe() { @@ -176,7 +176,7 @@ rf_BootRaidframe() /* * Called whenever an array is shutdown */ -static void +static void rf_UnconfigureArray() { @@ -201,7 +201,7 @@ rf_UnconfigureArray() /* * Called to shut down an array. */ -int +int rf_Shutdown(RF_Raid_t *raidPtr) { @@ -282,7 +282,7 @@ rf_Shutdown(RF_Raid_t *raidPtr) rf_mutex_init((_m_)); \ } -int +int rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) { RF_RowCol_t col; @@ -299,7 +299,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) /* * Yes, this does make debugging general to the whole - * system instead of being array specific. Bummer, drag. + * system instead of being array specific. Bummer, drag. */ rf_ConfigureDebug(cfgPtr); DO_INIT_CONFIGURE(rf_ConfigureDebugMem); @@ -340,7 +340,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) raidPtr->status = rf_rs_optimal; raidPtr->reconControl = NULL; - + TAILQ_INIT(&(raidPtr->iodone)); simple_lock_init(&(raidPtr->iodone_lock)); @@ -388,7 +388,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) raidPtr->recon_in_progress = 0; raidPtr->maxOutstanding = cfgPtr->maxOutstandingDiskReqs; - /* autoconfigure and root_partition will actually get filled in + /* autoconfigure and root_partition will actually get filled in after the config is done */ raidPtr->autoconfigure = 0; raidPtr->root_partition = 0; @@ -402,7 +402,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) /* Allocate a bunch of buffers to be used in low-memory conditions */ raidPtr->iobuf = NULL; - rc = rf_AllocEmergBuffers(raidPtr); + rc = rf_AllocEmergBuffers(raidPtr); if (rc) { printf("raid%d: Unable to allocate emergency buffers.\n", raidPtr->raidid); @@ -426,7 +426,7 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) printf("raid%d: Total Sectors: %lu (%lu MB)\n", raidPtr->raidid, (unsigned long) raidPtr->totalSectors, - (unsigned long) (raidPtr->totalSectors / 1024 * + (unsigned long) (raidPtr->totalSectors / 1024 * (1 << raidPtr->logBytesPerSector) / 1024)); return (0); @@ -437,11 +437,11 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac) Routines to allocate and free the "emergency buffers" for a given RAID set. These emergency buffers will be used when the kernel runs - out of kernel memory. - + out of kernel memory. + */ -static int +static int rf_AllocEmergBuffers(RF_Raid_t *raidPtr) { void *tmpbuf; @@ -453,13 +453,13 @@ rf_AllocEmergBuffers(RF_Raid_t *raidPtr) #if DEBUG printf("raid%d: allocating %d buffers of %d bytes.\n", raidPtr->raidid, - raidPtr->numEmergencyBuffers, - (int)(raidPtr->Layout.sectorsPerStripeUnit << + raidPtr->numEmergencyBuffers, + (int)(raidPtr->Layout.sectorsPerStripeUnit << raidPtr->logBytesPerSector)); #endif for (i = 0; i < raidPtr->numEmergencyBuffers; i++) { - tmpbuf = malloc( raidPtr->Layout.sectorsPerStripeUnit << - raidPtr->logBytesPerSector, + tmpbuf = malloc( raidPtr->Layout.sectorsPerStripeUnit << + raidPtr->logBytesPerSector, M_RAIDFRAME, M_NOWAIT); if (tmpbuf) { vple = rf_AllocVPListElem(); @@ -492,7 +492,7 @@ rf_AllocEmergBuffers(RF_Raid_t *raidPtr) break; } } - + return (0); } @@ -519,13 +519,13 @@ rf_FreeEmergBuffers(RF_Raid_t *raidPtr) } -static void +static void rf_ShutdownRDFreeList(void *ignored) { pool_destroy(&rf_pools.rad); } -static int +static int rf_ConfigureRDFreeList(RF_ShutdownList_t **listp) { @@ -586,7 +586,7 @@ rf_AllocRaidAccDesc(RF_Raid_t *raidPtr, RF_IoType_t type, return (desc); } -void +void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) { RF_Raid_t *raidPtr = desc->raidPtr; @@ -633,7 +633,7 @@ rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) * RF_FALSE bp_in is a buf pointer. void * to facilitate ignoring it * outside the kernel ********************************************************************/ -int +int rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, int async_flag, RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks, caddr_t bufPtr, struct buf *bp, RF_RaidAccessFlags_t flags) @@ -676,7 +676,7 @@ rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, int async_flag, } #if 0 /* force the array into reconfigured mode without doing reconstruction */ -int +int rf_SetReconfiguredMode(RF_Raid_t *raidPtr, int col) { if (!(raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE)) { @@ -697,12 +697,12 @@ rf_SetReconfiguredMode(RF_Raid_t *raidPtr, int col) } #endif -int +int rf_FailDisk(RF_Raid_t *raidPtr, int fcol, int initRecon) { /* need to suspend IO's here -- if there are DAGs in flight - and we pull the rug out from under ci_vp, Bad Things + and we pull the rug out from under ci_vp, Bad Things can happen. */ rf_SuspendNewRequestsAndWait(raidPtr); @@ -710,17 +710,17 @@ rf_FailDisk(RF_Raid_t *raidPtr, int fcol, int initRecon) RF_LOCK_MUTEX(raidPtr->mutex); 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 + already marked as failed (in which case we don't want to mark it failed again!) */ raidPtr->numFailures++; raidPtr->Disks[fcol].status = rf_ds_failed; - raidPtr->status = rf_rs_degraded; + raidPtr->status = rf_rs_degraded; } RF_UNLOCK_MUTEX(raidPtr->mutex); - + rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE); - - /* Close the component, so that it's not "locked" if someone + + /* Close the component, so that it's not "locked" if someone else want's to use it! */ rf_close_component(raidPtr, raidPtr->raid_cinfo[fcol].ci_vp, @@ -729,7 +729,7 @@ rf_FailDisk(RF_Raid_t *raidPtr, int fcol, int initRecon) RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->raid_cinfo[fcol].ci_vp = NULL; - /* Need to mark the component as not being auto_configured + /* Need to mark the component as not being auto_configured (in case it was previously). */ raidPtr->Disks[fcol].auto_configured = 0; @@ -746,12 +746,12 @@ rf_FailDisk(RF_Raid_t *raidPtr, int fcol, int initRecon) /* releases a thread that is waiting for the array to become quiesced. * access_suspend_mutex should be locked upon calling this */ -void +void rf_SignalQuiescenceLock(RF_Raid_t *raidPtr) { #if RF_DEBUG_QUIESCE if (rf_quiesceDebug) { - printf("raid%d: Signalling quiescence lock\n", + printf("raid%d: Signalling quiescence lock\n", raidPtr->raidid); } #endif @@ -762,7 +762,7 @@ rf_SignalQuiescenceLock(RF_Raid_t *raidPtr) } } /* suspends all new requests to the array. No effect on accesses that are in flight. */ -int +int rf_SuspendNewRequestsAndWait(RF_Raid_t *raidPtr) { #if RF_DEBUG_QUIESCE @@ -792,7 +792,7 @@ rf_SuspendNewRequestsAndWait(RF_Raid_t *raidPtr) return (raidPtr->waiting_for_quiescence); } /* wake up everyone waiting for quiescence to be released */ -void +void rf_ResumeNewRequests(RF_Raid_t *raidPtr) { RF_CallbackDesc_t *t, *cb; @@ -824,7 +824,7 @@ rf_ResumeNewRequests(RF_Raid_t *raidPtr) * ****************************************************************************************/ -static void +static void set_debug_option(char *name, long val) { RF_DebugName_t *p; @@ -842,7 +842,7 @@ set_debug_option(char *name, long val) /* would like to use sscanf here, but apparently not available in kernel */ /*ARGSUSED*/ -static void +static void rf_ConfigureDebug(RF_Config_t *cfgPtr) { char *val_p, *name_p, *white_p; diff --git a/sys/dev/raidframe/rf_driver.h b/sys/dev/raidframe/rf_driver.h index e0e4c794b07..a46710e5782 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.14 2005/02/13 20:27:48 oster Exp $ */ +/* $NetBSD: rf_driver.h,v 1.15 2005/02/27 00:27:44 perry Exp $ */ /* * rf_driver.h */ @@ -47,12 +47,12 @@ int rf_UnbootRaidframe(void); int rf_Shutdown(RF_Raid_t *); int rf_Configure(RF_Raid_t *, RF_Config_t *, RF_AutoConfig_t *); RF_RaidAccessDesc_t *rf_AllocRaidAccDesc(RF_Raid_t *, RF_IoType_t, - RF_RaidAddr_t, RF_SectorCount_t, - caddr_t, void *, - RF_RaidAccessFlags_t, + RF_RaidAddr_t, RF_SectorCount_t, + caddr_t, void *, + RF_RaidAccessFlags_t, const RF_AccessState_t *); void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *); -int rf_DoAccess(RF_Raid_t *, RF_IoType_t, int, RF_RaidAddr_t, +int rf_DoAccess(RF_Raid_t *, RF_IoType_t, int, RF_RaidAddr_t, RF_SectorCount_t, caddr_t, struct buf *, RF_RaidAccessFlags_t); #if 0 diff --git a/sys/dev/raidframe/rf_engine.c b/sys/dev/raidframe/rf_engine.c index 3015be115c6..de2f879922f 100644 --- a/sys/dev/raidframe/rf_engine.c +++ b/sys/dev/raidframe/rf_engine.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_engine.c,v 1.34 2004/03/09 03:10:26 oster Exp $ */ +/* $NetBSD: rf_engine.c,v 1.35 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -55,7 +55,7 @@ ****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.34 2004/03/09 03:10:26 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.35 2005/02/27 00:27:44 perry Exp $"); #include <sys/errno.h> @@ -92,7 +92,7 @@ do { \ #define DO_SIGNAL(_r_) \ RF_BROADCAST_COND((_r_)->node_queue) /* XXX RF_SIGNAL_COND? */ -static void +static void rf_ShutdownEngine(void *arg) { RF_Raid_t *raidPtr; @@ -121,7 +121,7 @@ rf_ShutdownEngine(void *arg) } -int +int rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -138,7 +138,7 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, printf("raid%d: Creating engine thread\n", raidPtr->raidid); } #endif - if (RF_CREATE_ENGINE_THREAD(raidPtr->engine_thread, + if (RF_CREATE_ENGINE_THREAD(raidPtr->engine_thread, DAGExecutionThread, raidPtr, "raid%d", raidPtr->raidid)) { printf("raid%d: Unable to create engine thread\n", @@ -146,9 +146,9 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (ENOMEM); } if (RF_CREATE_ENGINE_THREAD(raidPtr->engine_helper_thread, - rf_RaidIOThread, raidPtr, + rf_RaidIOThread, raidPtr, "raidio%d", raidPtr->raidid)) { - printf("raid%d: Unable to create raidio thread\n", + printf("raid%d: Unable to create raidio thread\n", raidPtr->raidid); return (ENOMEM); } @@ -169,7 +169,7 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -static int +static int BranchDone(RF_DagNode_t *node) { int i; @@ -210,7 +210,7 @@ BranchDone(RF_DagNode_t *node) } } -static int +static int NodeReady(RF_DagNode_t *node) { int ready; @@ -218,7 +218,7 @@ NodeReady(RF_DagNode_t *node) switch (node->dagHdr->status) { case rf_enable: case rf_rollForward: - if ((node->status == rf_wait) && + if ((node->status == rf_wait) && (node->numAntecedents == node->numAntDone)) ready = RF_TRUE; else @@ -228,7 +228,7 @@ NodeReady(RF_DagNode_t *node) RF_ASSERT(node->numSuccDone <= node->numSuccedents); RF_ASSERT(node->numSuccFired <= node->numSuccedents); RF_ASSERT(node->numSuccFired <= node->numSuccDone); - if ((node->status == rf_good) && + if ((node->status == rf_good) && (node->numSuccDone == node->numSuccedents)) ready = RF_TRUE; else @@ -250,7 +250,7 @@ NodeReady(RF_DagNode_t *node) * This routine assumes that the node's status field has alread been * set to "fired" or "recover" to indicate the direction of execution. */ -static void +static void FireNode(RF_DagNode_t *node) { switch (node->status) { @@ -258,8 +258,8 @@ FireNode(RF_DagNode_t *node) /* fire the do function of a node */ #if RF_DEBUG_ENGINE if (rf_engineDebug) { - printf("raid%d: Firing node 0x%lx (%s)\n", - node->dagHdr->raidPtr->raidid, + printf("raid%d: Firing node 0x%lx (%s)\n", + node->dagHdr->raidPtr->raidid, (unsigned long) node, node->name); } #endif @@ -279,7 +279,7 @@ FireNode(RF_DagNode_t *node) /* fire the undo function of a node */ #if RF_DEBUG_ENGINE if (rf_engineDebug) { - printf("raid%d: Firing (undo) node 0x%lx (%s)\n", + printf("raid%d: Firing (undo) node 0x%lx (%s)\n", node->dagHdr->raidPtr->raidid, (unsigned long) node, node->name); } @@ -307,7 +307,7 @@ FireNode(RF_DagNode_t *node) * Attempt to fire each node in a linear array. * The entire list is fired atomically. */ -static void +static void FireNodeArray(int numNodes, RF_DagNode_t **nodeList) { RF_DagStatus_t dstat; @@ -318,10 +318,10 @@ FireNodeArray(int numNodes, RF_DagNode_t **nodeList) for (i = 0; i < numNodes; i++) { node = nodeList[i]; dstat = node->dagHdr->status; - RF_ASSERT((node->status == rf_wait) || + RF_ASSERT((node->status == rf_wait) || (node->status == rf_good)); if (NodeReady(node)) { - if ((dstat == rf_enable) || + if ((dstat == rf_enable) || (dstat == rf_rollForward)) { RF_ASSERT(node->status == rf_wait); if (node->commitNode) @@ -340,7 +340,7 @@ FireNodeArray(int numNodes, RF_DagNode_t **nodeList) } /* now, fire the nodes */ for (i = 0; i < numNodes; i++) { - if ((nodeList[i]->status == rf_fired) || + if ((nodeList[i]->status == rf_fired) || (nodeList[i]->status == rf_recover)) FireNode(nodeList[i]); } @@ -351,7 +351,7 @@ FireNodeArray(int numNodes, RF_DagNode_t **nodeList) * Attempt to fire each node in a linked list. * The entire list is fired atomically. */ -static void +static void FireNodeList(RF_DagNode_t *nodeList) { RF_DagNode_t *node, *next; @@ -363,10 +363,10 @@ FireNodeList(RF_DagNode_t *nodeList) for (node = nodeList; node; node = next) { next = node->next; dstat = node->dagHdr->status; - RF_ASSERT((node->status == rf_wait) || + RF_ASSERT((node->status == rf_wait) || (node->status == rf_good)); if (NodeReady(node)) { - if ((dstat == rf_enable) || + if ((dstat == rf_enable) || (dstat == rf_rollForward)) { RF_ASSERT(node->status == rf_wait); if (node->commitNode) @@ -386,7 +386,7 @@ FireNodeList(RF_DagNode_t *nodeList) /* now, fire the nodes */ for (node = nodeList; node; node = next) { next = node->next; - if ((node->status == rf_fired) || + if ((node->status == rf_fired) || (node->status == rf_recover)) FireNode(node); } @@ -408,7 +408,7 @@ FireNodeList(RF_DagNode_t *nodeList) * must be locked. I used the node queue mutex and locked down the * entire function, but this is certainly overkill. */ -static void +static void PropagateResults(RF_DagNode_t *node, int context) { RF_DagNode_t *s, *a; @@ -475,7 +475,7 @@ PropagateResults(RF_DagNode_t *node, int context) unlock */ s->next = firelist; firelist = s; - } else { + } else { /* enqueue the node for the dag @@ -555,13 +555,13 @@ PropagateResults(RF_DagNode_t *node, int context) if (context != RF_INTR_CONTEXT) { /* we only have to enqueue if * we're at intr context */ - /* put node on a list to be + /* put node on a list to be fired after we unlock */ a->next = firelist; firelist = a; } else { - /* enqueue the node for the + /* enqueue the node for the dag exec thread to fire */ RF_ASSERT(NodeReady(a)); if (q) { @@ -582,7 +582,7 @@ PropagateResults(RF_DagNode_t *node, int context) DO_SIGNAL(raidPtr); } DO_UNLOCK(raidPtr); - for (; finishlist; finishlist = next) { + for (; finishlist; finishlist = next) { /* NIL nodes: no need to fire them */ next = finishlist->next; finishlist->status = rf_good; @@ -614,7 +614,7 @@ PropagateResults(RF_DagNode_t *node, int context) /* * Process a fired node which has completed */ -static void +static void ProcessNode(RF_DagNode_t *node, int context) { RF_Raid_t *raidPtr; @@ -626,10 +626,10 @@ ProcessNode(RF_DagNode_t *node, int context) /* normal case, don't need to do anything */ break; case rf_bad: - if ((node->dagHdr->numCommits > 0) || + if ((node->dagHdr->numCommits > 0) || (node->dagHdr->numCommitNodes == 0)) { /* crossed commit barrier */ - node->dagHdr->status = rf_rollForward; + node->dagHdr->status = rf_rollForward; #if RF_DEBUG_ENGINE if (rf_engineDebug) { printf("raid%d: node (%s) returned fail, rolling forward\n", raidPtr->raidid, node->name); @@ -637,7 +637,7 @@ ProcessNode(RF_DagNode_t *node, int context) #endif } else { /* never reached commit barrier */ - node->dagHdr->status = rf_rollBackward; + node->dagHdr->status = rf_rollBackward; #if RF_DEBUG_ENGINE if (rf_engineDebug) { printf("raid%d: node (%s) returned fail, rolling backward\n", raidPtr->raidid, node->name); @@ -670,7 +670,7 @@ ProcessNode(RF_DagNode_t *node, int context) * This routine is called by each node execution function to mark the node * as complete and fire off any successors that have been enabled. */ -int +int rf_FinishNode(RF_DagNode_t *node, int context) { int retcode = RF_FALSE; @@ -691,7 +691,7 @@ rf_FinishNode(RF_DagNode_t *node, int context) * * All we do here is fire the direct successors of the header node. * The DAG execution thread does the rest of the dag processing. */ -int +int rf_DispatchDAG(RF_DagHeader_t *dag, void (*cbFunc) (void *), void *cbArg) { @@ -730,10 +730,10 @@ rf_DispatchDAG(RF_DagHeader_t *dag, void (*cbFunc) (void *), * entire node queue and then set the node queue to NULL before doing * any firing of nodes. This way we only have to release the lock * once. Of course, it's probably rare that there's more than one - * node in the queue at any one time, but it sometimes happens. + * node in the queue at any one time, but it sometimes happens. */ -static void +static void DAGExecutionThread(RF_ThreadArg_t arg) { RF_DagNode_t *nd, *local_nq, *term_nq, *fire_nq; @@ -813,7 +813,7 @@ DAGExecutionThread(RF_ThreadArg_t arg) DO_LOCK(raidPtr); } - while (!raidPtr->shutdown_engine && + while (!raidPtr->shutdown_engine && raidPtr->node_queue == NULL) { DO_WAIT(raidPtr); } @@ -824,12 +824,12 @@ DAGExecutionThread(RF_ThreadArg_t arg) kthread_exit(0); } -/* +/* * rf_RaidIOThread() -- When I/O to a component completes, * KernelWakeupFunc() puts the completed request onto raidPtr->iodone * TAILQ. This function looks after requests on that queue by calling * rf_DiskIOComplete() for the request, and by calling any required - * CompleteFunc for the request. + * CompleteFunc for the request. */ static void diff --git a/sys/dev/raidframe/rf_engine.h b/sys/dev/raidframe/rf_engine.h index 9486d5110ac..f4f5b89046d 100644 --- a/sys/dev/raidframe/rf_engine.h +++ b/sys/dev/raidframe/rf_engine.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_engine.h,v 1.4 2004/03/04 02:26:50 oster Exp $ */ +/* $NetBSD: rf_engine.h,v 1.5 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ int rf_ConfigureEngine(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *); int rf_FinishNode(RF_DagNode_t *, int); /* return finished node to engine */ -int rf_DispatchDAG(RF_DagHeader_t *, +int rf_DispatchDAG(RF_DagHeader_t *, void (*cbFunc) (void *), void *); /* execute dag */ #endif /* !_RF__RF_ENGINE_H_ */ diff --git a/sys/dev/raidframe/rf_evenodd.c b/sys/dev/raidframe/rf_evenodd.c index cc32b505014..e3cf5b8b7a3 100644 --- a/sys/dev/raidframe/rf_evenodd.c +++ b/sys/dev/raidframe/rf_evenodd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd.c,v 1.13 2004/01/10 00:56:28 oster Exp $ */ +/* $NetBSD: rf_evenodd.c,v 1.14 2005/02/27 00:27:44 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ****************************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_evenodd.c,v 1.13 2004/01/10 00:56:28 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_evenodd.c,v 1.14 2005/02/27 00:27:44 perry Exp $"); #include "rf_archs.h" @@ -67,7 +67,7 @@ typedef struct RF_EvenOddConfigInfo_s { * IdentifyStripe */ } RF_EvenOddConfigInfo_t; -int +int rf_ConfigureEvenOdd(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -120,19 +120,19 @@ rf_ConfigureEvenOdd(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -int +int rf_GetDefaultNumFloatingReconBuffersEvenOdd(RF_Raid_t *raidPtr) { return (20); } -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitEvenOdd(RF_Raid_t *raidPtr) { return (10); } -void +void rf_IdentifyStripeEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids, RF_RowCol_t *outRow) { @@ -157,7 +157,7 @@ rf_IdentifyStripeEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, */ -void +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) @@ -171,7 +171,7 @@ rf_MapParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +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) @@ -185,7 +185,7 @@ rf_MapEEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_EODagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_AccessStripeMap_t *asmap, RF_VoidFuncPtr *createFunc) { @@ -332,7 +332,7 @@ rf_EODagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, } -int +int rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t *parityPDA, int correct_it, RF_RaidAccessFlags_t flags) diff --git a/sys/dev/raidframe/rf_evenodd.h b/sys/dev/raidframe/rf_evenodd.h index 497f0ea9c1a..b130b9a18ff 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.3 2003/12/29 02:38:17 oster Exp $ */ +/* $NetBSD: rf_evenodd.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. @@ -30,24 +30,24 @@ #define _RF__RF_EVENODD_H_ /* extern declerations of the failure mode functions. */ -int +int rf_ConfigureEvenOdd(RF_ShutdownList_t ** shutdownListp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersEvenOdd(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitEvenOdd(RF_Raid_t * raidPtr); -void +void rf_IdentifyStripeEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids, RF_RowCol_t * outrow); -void +void rf_MapParityEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapEEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_EODagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); -int +int rf_VerifyParityEvenOdd(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags); diff --git a/sys/dev/raidframe/rf_evenodd_dagfuncs.c b/sys/dev/raidframe/rf_evenodd_dagfuncs.c index d04e263769e..6abce0a607d 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.13 2003/12/29 02:38:17 oster Exp $ */ +/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.14 2005/02/27 00:27:45 perry 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.13 2003/12/29 02:38:17 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.14 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" #include "opt_raid_diagnostic.h" @@ -63,7 +63,7 @@ RF_RedFuncs_t rf_eoERecoveryFuncs = {rf_RecoveryEFunc, "Recovery E Func", rf_Rec /********************************************************************************************** * the following encoding node functions is used in EO_000_CreateLargeWriteDAG **********************************************************************************************/ -int +int rf_RegularPEFunc(node) RF_DagNode_t *node; { @@ -93,7 +93,7 @@ rf_RegularPEFunc(node) old data and new data, then encode temp buf into old 'E' buf to form new 'E', but this approach take the same speed as the previous, and need more memory. */ -int +int rf_RegularONEFunc(node) RF_DagNode_t *node; { @@ -153,7 +153,7 @@ rf_RegularONEFunc(node) #endif } -int +int rf_SimpleONEFunc(node) RF_DagNode_t *node; { @@ -194,7 +194,7 @@ rf_SimpleONEFunc(node) /****** called by rf_RegularPEFunc(node) and rf_RegularEFunc(node) in f.f. large write ********/ -void +void rf_RegularESubroutine(node, ebuf) RF_DagNode_t *node; char *ebuf; @@ -227,7 +227,7 @@ rf_RegularESubroutine(node, ebuf) /******************************************************************************************* * Used in EO_001_CreateLargeWriteDAG ******************************************************************************************/ -int +int rf_RegularEFunc(node) RF_DagNode_t *node; { @@ -250,7 +250,7 @@ rf_RegularEFunc(node) * other than the above two into smaller accesses. We may have to change * DegrESubroutin in the future. *******************************************************************************************/ -void +void rf_DegrESubroutine(node, ebuf) RF_DagNode_t *node; char *ebuf; @@ -288,7 +288,7 @@ rf_DegrESubroutine(node, ebuf) * failed in the stripe but not accessed at this time, then we should, instead, use * the rf_EOWriteDoubleRecoveryFunc(). **************************************************************************************/ -int +int rf_Degraded_100_EOFunc(node) RF_DagNode_t *node; { @@ -304,7 +304,7 @@ rf_Degraded_100_EOFunc(node) * However, in evenodd this function can also be used as decoding function to recover * data from dead disk in the case of parity failure and a single data failure. **************************************************************************************/ -void +void rf_e_EncOneSect( RF_RowCol_t srcLogicCol, char *srcSecbuf, @@ -379,7 +379,7 @@ rf_e_EncOneSect( } } -void +void rf_e_encToBuf( RF_Raid_t * raidPtr, RF_RowCol_t srcLogicCol, @@ -401,7 +401,7 @@ rf_e_encToBuf( * to recover the data in dead disk. This function is used in the recovery node of * for EO_110_CreateReadDAG **************************************************************************************/ -int +int rf_RecoveryEFunc(node) RF_DagNode_t *node; { @@ -445,7 +445,7 @@ rf_RecoveryEFunc(node) * This function is used in the case where one data and the parity have filed. * (in EO_110_CreateWriteDAG ) **************************************************************************************/ -int +int rf_EO_DegradedWriteEFunc(RF_DagNode_t * node) { rf_DegrESubroutine(node, node->results[0]); @@ -461,7 +461,7 @@ rf_EO_DegradedWriteEFunc(RF_DagNode_t * node) * THE FUNCTION IS FOR DOUBLE DEGRADED READ AND WRITE CASES **************************************************************************************/ -void +void rf_doubleEOdecode( RF_Raid_t * raidPtr, char **rrdbuf, @@ -654,7 +654,7 @@ rf_doubleEOdecode( * EO_200_CreateReadDAG * ***************************************************************************************/ -int +int rf_EvenOddDoubleRecoveryFunc(node) RF_DagNode_t *node; { @@ -852,7 +852,7 @@ rf_EvenOddDoubleRecoveryFunc(node) * many accesses of single stripe unit. */ -int +int rf_EOWriteDoubleRecoveryFunc(node) RF_DagNode_t *node; { diff --git a/sys/dev/raidframe/rf_evenodd_dagfuncs.h b/sys/dev/raidframe/rf_evenodd_dagfuncs.h index 3a1f6df19d5..ef191945c01 100644 --- a/sys/dev/raidframe/rf_evenodd_dagfuncs.h +++ b/sys/dev/raidframe/rf_evenodd_dagfuncs.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd_dagfuncs.h,v 1.3 2003/02/05 00:02:38 perry Exp $ */ +/* $NetBSD: rf_evenodd_dagfuncs.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * rf_evenodd_dagfuncs.h */ @@ -45,15 +45,15 @@ void rf_RegularESubroutine(RF_DagNode_t * node, char *ebuf); int rf_RegularEFunc(RF_DagNode_t * node); void rf_DegrESubroutine(RF_DagNode_t * node, char *ebuf); int rf_Degraded_100_EOFunc(RF_DagNode_t * node); -void +void rf_e_EncOneSect(RF_RowCol_t srcLogicCol, char *srcSecbuf, RF_RowCol_t destLogicCol, char *destSecbuf, int bytesPerSector); -void +void rf_e_encToBuf(RF_Raid_t * raidPtr, RF_RowCol_t srcLogicCol, char *srcbuf, RF_RowCol_t destLogicCol, char *destbuf, int numSector); int rf_RecoveryEFunc(RF_DagNode_t * node); int rf_EO_DegradedWriteEFunc(RF_DagNode_t * node); -void +void rf_doubleEOdecode(RF_Raid_t * raidPtr, char **rrdbuf, char **dest, RF_RowCol_t * fcol, char *pbuf, char *ebuf); int rf_EvenOddDoubleRecoveryFunc(RF_DagNode_t * node); diff --git a/sys/dev/raidframe/rf_fifo.c b/sys/dev/raidframe/rf_fifo.c index a2485bc3e0e..6aac80827f4 100644 --- a/sys/dev/raidframe/rf_fifo.c +++ b/sys/dev/raidframe/rf_fifo.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_fifo.c,v 1.11 2004/03/04 01:53:26 oster Exp $ */ +/* $NetBSD: rf_fifo.c,v 1.12 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,7 +36,7 @@ ***************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.11 2004/03/04 01:53:26 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.12 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -58,13 +58,13 @@ rf_FifoCreate(RF_SectorCount_t sectPerDisk, RF_AllocListElem_t *clList, { RF_FifoHeader_t *q; - RF_MallocAndAdd(q, sizeof(RF_FifoHeader_t), + RF_MallocAndAdd(q, sizeof(RF_FifoHeader_t), (RF_FifoHeader_t *), clList); q->hq_count = q->lq_count = 0; return ((void *) q); } -void +void rf_FifoEnqueue(void *q_in, RF_DiskQueueData_t *elem, int priority) { RF_FifoHeader_t *q = (RF_FifoHeader_t *) q_in; @@ -86,7 +86,7 @@ rf_FifoEnqueue(void *q_in, RF_DiskQueueData_t *elem, int priority) RF_ASSERT(elem->next == NULL); #if RF_DEBUG_QUEUE if (rf_fifoDebug) { - printf("raid%d: fifo: ENQ lopri\n", + printf("raid%d: fifo: ENQ lopri\n", elem->raidPtr->raidid); } #endif @@ -137,7 +137,7 @@ rf_FifoDequeue(void *q_in) q->lq_count--; #if RF_DEBUG_QUEUE if (rf_fifoDebug) { - printf("raid%d: fifo: DEQ lopri %lx\n", + printf("raid%d: fifo: DEQ lopri %lx\n", nd->raidPtr->raidid, (long) nd); } #endif @@ -172,7 +172,7 @@ rf_FifoPeek(void *q_in) * the low priority queue to the end of the normal priority queue. * We assume the queue is locked upon entry. */ -int +int rf_FifoPromote(void *q_in, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru) { @@ -208,7 +208,7 @@ rf_FifoPromote(void *q_in, RF_StripeNum_t parityStripeID, q->hq_tail->next = lp; q->hq_tail = lp; } - /* append to hi-priority queue */ + /* append to hi-priority queue */ else { q->hq_head = q->hq_tail = lp; } diff --git a/sys/dev/raidframe/rf_fifo.h b/sys/dev/raidframe/rf_fifo.h index 9fa00435181..3d9cb1e50df 100644 --- a/sys/dev/raidframe/rf_fifo.h +++ b/sys/dev/raidframe/rf_fifo.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_fifo.h,v 1.4 2001/10/04 15:58:53 oster Exp $ */ +/* $NetBSD: rf_fifo.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -50,12 +50,12 @@ typedef struct RF_FifoHeader_s { extern void * rf_FifoCreate(RF_SectorCount_t sectPerDisk, RF_AllocListElem_t * clList, RF_ShutdownList_t ** listp); -extern void +extern void rf_FifoEnqueue(void *q_in, RF_DiskQueueData_t * elem, int priority); extern RF_DiskQueueData_t *rf_FifoDequeue(void *q_in); extern RF_DiskQueueData_t *rf_FifoPeek(void *q_in); -extern int +extern int rf_FifoPromote(void *q_in, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru); diff --git a/sys/dev/raidframe/rf_general.h b/sys/dev/raidframe/rf_general.h index 0de16325820..36f09fb0a76 100644 --- a/sys/dev/raidframe/rf_general.h +++ b/sys/dev/raidframe/rf_general.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_general.h,v 1.13 2004/01/01 20:39:58 oster Exp $ */ +/* $NetBSD: rf_general.h,v 1.14 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -54,7 +54,7 @@ void rf_print_assert_panic_message(int, char *, char *); void rf_print_unable_to_init_mutex(char *, int, int); void rf_print_unable_to_add_shutdown(char *, int, int); - + extern char rf_panicbuf[]; #define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__); panic(rf_panicbuf);} diff --git a/sys/dev/raidframe/rf_interdecluster.c b/sys/dev/raidframe/rf_interdecluster.c index 55daf4f8856..59f2dd67517 100644 --- a/sys/dev/raidframe/rf_interdecluster.c +++ b/sys/dev/raidframe/rf_interdecluster.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_interdecluster.c,v 1.9 2003/01/20 05:30:08 simonb Exp $ */ +/* $NetBSD: rf_interdecluster.c,v 1.10 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_interdecluster.c,v 1.9 2003/01/20 05:30:08 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_interdecluster.c,v 1.10 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -61,7 +61,7 @@ typedef struct RF_InterdeclusterConfigInfo_s { RF_SectorNum_t mirrorStripeOffset; } RF_InterdeclusterConfigInfo_t; -int +int rf_ConfigureInterDecluster( RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, @@ -123,19 +123,19 @@ rf_ConfigureInterDecluster( return (0); } -int +int rf_GetDefaultNumFloatingReconBuffersInterDecluster(RF_Raid_t * raidPtr) { return (30); } -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitInterDecluster(RF_Raid_t * raidPtr) { return (raidPtr->sectorsPerDisk); } -RF_ReconUnitCount_t +RF_ReconUnitCount_t rf_GetNumSpareRUsInterDecluster( RF_Raid_t * raidPtr) { @@ -146,7 +146,7 @@ rf_GetNumSpareRUsInterDecluster( * sparing region */ } /* Maps to the primary copy of the data, i.e. the first mirror pair */ -void +void rf_MapSectorInterDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -185,7 +185,7 @@ rf_MapSectorInterDecluster( } } /* Maps to the second copy of the mirror pair. */ -void +void rf_MapParityInterDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -223,7 +223,7 @@ rf_MapParityInterDecluster( } } -void +void rf_IdentifyStripeInterDecluster( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, @@ -240,7 +240,7 @@ rf_IdentifyStripeInterDecluster( *diskids = info->stripeIdentifier[SUID]; } -void +void rf_MapSIDToPSIDInterDecluster( RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, @@ -259,7 +259,7 @@ rf_MapSIDToPSIDInterDecluster( * createFunc - name of function to use to create the graph *****************************************************************************/ -void +void rf_RAIDIDagSelect( RF_Raid_t * raidPtr, RF_IoType_t type, diff --git a/sys/dev/raidframe/rf_interdecluster.h b/sys/dev/raidframe/rf_interdecluster.h index e5182af1c51..9480120e4f7 100644 --- a/sys/dev/raidframe/rf_interdecluster.h +++ b/sys/dev/raidframe/rf_interdecluster.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_interdecluster.h,v 1.3 1999/02/05 00:06:12 oster Exp $ */ +/* $NetBSD: rf_interdecluster.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,26 +33,26 @@ #ifndef _RF__RF_INTERDECLUSTER_H_ #define _RF__RF_INTERDECLUSTER_H_ -int +int rf_ConfigureInterDecluster(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersInterDecluster(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitInterDecluster(RF_Raid_t * raidPtr); RF_ReconUnitCount_t rf_GetNumSpareRUsInterDecluster(RF_Raid_t * raidPtr); -void +void rf_MapSectorInterDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityInterDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * row, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeInterDecluster(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids, RF_RowCol_t * outRow); -void +void rf_MapSIDToPSIDInterDecluster(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RAIDIDagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); diff --git a/sys/dev/raidframe/rf_layout.c b/sys/dev/raidframe/rf_layout.c index 553f1efb965..844be162832 100644 --- a/sys/dev/raidframe/rf_layout.c +++ b/sys/dev/raidframe/rf_layout.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_layout.c,v 1.16 2004/01/04 06:37:16 oster Exp $ */ +/* $NetBSD: rf_layout.c,v 1.17 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_layout.c,v 1.16 2004/01/04 06:37:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_layout.c,v 1.17 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -79,13 +79,13 @@ __KERNEL_RCSID(0, "$NetBSD: rf_layout.c,v 1.16 2004/01/04 06:37:16 oster Exp $") static const RF_AccessState_t DefaultStates[] = { rf_QuiesceState, - rf_IncrAccessesCountState, - rf_MapState, - rf_LockState, + rf_IncrAccessesCountState, + rf_MapState, + rf_LockState, rf_CreateDAGState, - rf_ExecuteDAGState, - rf_ProcessDAGState, - rf_CleanupState, + rf_ExecuteDAGState, + rf_ProcessDAGState, + rf_CleanupState, rf_DecrAccessesCountState, rf_LastState}; @@ -398,7 +398,7 @@ rf_GetLayout(RF_ParityConfig_t parityConfig) * configuration routine to finish the configuration. * ****************************************************************************/ -int +int rf_ConfigureLayout(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -414,9 +414,9 @@ rf_ConfigureLayout(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, if (layoutPtr->sectorsPerStripeUnit <= 0) { RF_ERRORMSG2("raid%d: Invalid sectorsPerStripeUnit: %d\n", - raidPtr->raidid, + raidPtr->raidid, (int)layoutPtr->sectorsPerStripeUnit ); - return (EINVAL); + return (EINVAL); } layoutPtr->stripeUnitsPerDisk = raidPtr->sectorsPerDisk / layoutPtr->sectorsPerStripeUnit; @@ -458,7 +458,7 @@ rf_ConfigureLayout(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, * the parity stripe identifier associated with a stripe ID. There is also * a RaidAddressToParityStripeID macro in layout.h */ -RF_StripeNum_t +RF_StripeNum_t rf_MapStripeIDToParityStripeID(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_ReconUnitNum_t *which_ru) diff --git a/sys/dev/raidframe/rf_layout.h b/sys/dev/raidframe/rf_layout.h index 21939abeca9..48aa8cbf7ec 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.14 2004/03/20 04:22:05 oster Exp $ */ +/* $NetBSD: rf_layout.h,v 1.15 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -185,7 +185,7 @@ struct RF_ASMHeaderListElem_s { RF_ASMHeaderListElem_t *next; }; -/* A structure to keep track of all the data structures associated with +/* A structure to keep track of all the data structures associated with a failed stripe. Used for constructing the appropriate DAGs in rf_SelectAlgorithm() in rf_aselect.c */ typedef struct RF_FailedStripe_s RF_FailedStripe_t; @@ -277,10 +277,10 @@ struct RF_FailedStripe_s { ( (_psid_) * (_layoutPtr_)->SUsPerPU * (_layoutPtr_)->numDataCol * (_layoutPtr_)->sectorsPerStripeUnit ) const RF_LayoutSW_t *rf_GetLayout(RF_ParityConfig_t parityConfig); -int +int rf_ConfigureLayout(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); -RF_StripeNum_t +RF_StripeNum_t rf_MapStripeIDToParityStripeID(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_ReconUnitNum_t * which_ru); diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c index 8b5d9b8aa0d..0342ff7a975 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.37 2004/03/20 04:22:05 oster Exp $ */ +/* $NetBSD: rf_map.c,v 1.38 2005/02/27 00:27:45 perry 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.37 2004/03/20 04:22:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.38 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -66,7 +66,7 @@ static void rf_FreeASMList(RF_AccessStripeMap_t *asm_list); * algorithm selection code to decide what subset of the parity unit * to access. Note that addresses in the RAID address space must * always be maintained as longs, instead of ints. - * + * * This routine returns NULL if numBlocks is 0 * * raidAddress - starting address in RAID address space @@ -92,7 +92,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, RF_PhysDiskAddr_t *pda_q; #endif RF_StripeCount_t numStripes = 0; - RF_RaidAddr_t stripeRealEndAddress, stripeEndAddress, + RF_RaidAddr_t stripeRealEndAddress, stripeEndAddress, nextStripeUnitAddress; RF_RaidAddr_t startAddrWithinStripe, lastRaidAddr; RF_StripeCount_t totStripes; @@ -111,8 +111,8 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, asmList = rf_AllocASMList(totStripes); /* may also need pda(s) per stripe for parity */ - pdaList = rf_AllocPDAList(lastSUID - SUID + 1 + - faultsTolerated * totStripes); + pdaList = rf_AllocPDAList(lastSUID - SUID + 1 + + faultsTolerated * totStripes); if (raidAddress + numBlocks > raidPtr->totalSectors) { @@ -151,7 +151,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, /* Raid addr of start of portion of access that is within this stripe */ - startAddrWithinStripe = raidAddress; + startAddrWithinStripe = raidAddress; for (; raidAddress < stripeEndAddress;) { RF_ASSERT(pdaList); @@ -166,9 +166,9 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, } pda_p->type = RF_PDA_TYPE_DATA; - (layoutPtr->map->MapSector) (raidPtr, raidAddress, - &(pda_p->col), - &(pda_p->startSector), + (layoutPtr->map->MapSector) (raidPtr, raidAddress, + &(pda_p->col), + &(pda_p->startSector), remap); /* mark any failures we find. failedPDA is @@ -177,7 +177,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, /* the RAID address corresponding to this physical diskaddress */ - pda_p->raidAddress = raidAddress; + pda_p->raidAddress = raidAddress; nextStripeUnitAddress = rf_RaidAddressOfNextStripeUnitBoundary(layoutPtr, raidAddress); pda_p->numSector = RF_MIN(endAddress, nextStripeUnitAddress) - raidAddress; RF_ASSERT(pda_p->numSector != 0); @@ -265,8 +265,8 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress, * do the right thing with this. ***************************************************************************/ -void -rf_MarkFailuresInASMList(RF_Raid_t *raidPtr, +void +rf_MarkFailuresInASMList(RF_Raid_t *raidPtr, RF_AccessStripeMapHeader_t *asm_h) { RF_RaidDisk_t *disks = raidPtr->Disks; @@ -338,7 +338,7 @@ rf_MarkFailuresInASMList(RF_Raid_t *raidPtr, /* called at shutdown time. So far, all that is necessary is to release all the free lists */ static void rf_ShutdownMapModule(void *); -static void +static void rf_ShutdownMapModule(void *ignored) { pool_destroy(&rf_pools.asm_hdr); @@ -350,7 +350,7 @@ rf_ShutdownMapModule(void *ignored) pool_destroy(&rf_pools.vple); } -int +int rf_ConfigureMapModule(RF_ShutdownList_t **listp) { @@ -384,7 +384,7 @@ rf_AllocAccessStripeMapHeader() return (p); } -void +void rf_FreeAccessStripeMapHeader(RF_AccessStripeMapHeader_t *p) { pool_put(&rf_pools.asm_hdr, p); @@ -499,13 +499,13 @@ rf_AllocPDAList(int count) return (p); } -void +void rf_FreePhysDiskAddr(RF_PhysDiskAddr_t *p) { pool_put(&rf_pools.pda, p); } -static void +static void rf_FreePDAList(RF_PhysDiskAddr_t *pda_list) { RF_PhysDiskAddr_t *p, *tmp; @@ -539,7 +539,7 @@ rf_AllocASMList(int count) return (p); } -static void +static void rf_FreeASMList(RF_AccessStripeMap_t *asm_list) { RF_AccessStripeMap_t *p, *tmp; @@ -552,7 +552,7 @@ rf_FreeASMList(RF_AccessStripeMap_t *asm_list) } } -void +void rf_FreeAccessStripeMap(RF_AccessStripeMapHeader_t *hdr) { RF_AccessStripeMap_t *p; @@ -621,7 +621,7 @@ rf_FreeAccessStripeMap(RF_AccessStripeMapHeader_t *hdr) * drive, which would mess up the computation of the stripe offset. * * ASSUMES AT MOST ONE FAILURE IN THE STRIPE. */ -int +int rf_CheckStripeForFailures(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) { RF_RowCol_t tcol, pcol, *diskids, i; @@ -638,11 +638,11 @@ rf_CheckStripeForFailures(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) if (numFailures == 0) return (0); - sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, + sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress); - (layoutPtr->map->IdentifyStripe) (raidPtr, asmap->raidAddress, + (layoutPtr->map->IdentifyStripe) (raidPtr, asmap->raidAddress, &diskids); - (layoutPtr->map->MapParity) (raidPtr, asmap->raidAddress, + (layoutPtr->map->MapParity) (raidPtr, asmap->raidAddress, &pcol, &poffset, 0); /* get pcol */ /* this need not be true if we've redirected the access to a @@ -673,7 +673,7 @@ rf_CheckStripeForFailures(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) return the number of failed data units in the stripe. */ -int +int rf_NumFailedDataUnitsInStripe(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -690,7 +690,7 @@ rf_NumFailedDataUnitsInStripe(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) return (0); numFailures = 0; - sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, + sosAddr = rf_RaidAddressOfPrevStripeBoundary(layoutPtr, asmap->raidAddress); for (i = 0; i < layoutPtr->numDataCol; i++) { (layoutPtr->map->MapSector) (raidPtr, sosAddr + i * layoutPtr->sectorsPerStripeUnit, @@ -709,7 +709,7 @@ rf_NumFailedDataUnitsInStripe(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) * ***************************************************************************/ #if RF_DEBUG_MAP -void +void rf_PrintAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h) { rf_PrintFullAccessStripeMap(asm_h, 0); @@ -717,7 +717,7 @@ rf_PrintAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h) #endif /* prbuf - flag to print buffer pointers */ -void +void rf_PrintFullAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h, int prbuf) { int i; @@ -771,8 +771,8 @@ rf_PrintFullAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h, int prbuf) } #if RF_MAP_DEBUG -void -rf_PrintRaidAddressInfo(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, +void +rf_PrintRaidAddressInfo(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_SectorCount_t numBlocks) { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -791,7 +791,7 @@ rf_PrintRaidAddressInfo(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, /* given a parity descriptor and the starting address within a stripe, * range restrict the parity descriptor to touch only the correct * stuff. */ -void +void rf_ASMParityAdjust(RF_PhysDiskAddr_t *toAdjust, RF_StripeNum_t startAddrWithinStripe, RF_SectorNum_t endAddress, @@ -807,7 +807,7 @@ rf_ASMParityAdjust(RF_PhysDiskAddr_t *toAdjust, * unit in size, it uses two disjoint regions of the parity * unit. When an access spans more than one stripe unit * boundary, it uses all of the parity unit. - * + * * To better handle the case where stripe units are small, we * may eventually want to change the 2nd case so that if the * SU size is below some threshold, we just read/write the @@ -825,7 +825,7 @@ rf_ASMParityAdjust(RF_PhysDiskAddr_t *toAdjust, /* create a second pda and copy the parity map info * into it */ RF_ASSERT(toAdjust->next == NULL); - /* the following will get freed in rf_FreeAccessStripeMap() via + /* the following will get freed in rf_FreeAccessStripeMap() via rf_FreePDAList() */ new_pda = toAdjust->next = rf_AllocPhysDiskAddr(); *new_pda = *toAdjust; /* structure assignment */ @@ -850,7 +850,7 @@ rf_ASMParityAdjust(RF_PhysDiskAddr_t *toAdjust, /* Check if a disk has been spared or failed. If spared, redirect the * I/O. If it has been failed, record it in the asm pointer. Fourth * arg is whether data or parity. */ -void +void rf_ASMCheckStatus(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda_p, RF_AccessStripeMap_t *asm_p, RF_RaidDisk_t *disks, int parity) diff --git a/sys/dev/raidframe/rf_mcpair.c b/sys/dev/raidframe/rf_mcpair.c index a5619006683..39f2fb50fda 100644 --- a/sys/dev/raidframe/rf_mcpair.c +++ b/sys/dev/raidframe/rf_mcpair.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_mcpair.c,v 1.17 2004/03/07 22:15:19 oster Exp $ */ +/* $NetBSD: rf_mcpair.c,v 1.18 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.17 2004/03/07 22:15:19 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.18 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -52,13 +52,13 @@ __KERNEL_RCSID(0, "$NetBSD: rf_mcpair.c,v 1.17 2004/03/07 22:15:19 oster Exp $") static void rf_ShutdownMCPair(void *); -static void +static void rf_ShutdownMCPair(void *ignored) { pool_destroy(&rf_pools.mcpair); } -int +int rf_ConfigureMCPair(RF_ShutdownList_t **listp) { @@ -82,7 +82,7 @@ rf_AllocMCPair() return (t); } -void +void rf_FreeMCPair(RF_MCPair_t *t) { pool_put(&rf_pools.mcpair, t); @@ -90,7 +90,7 @@ rf_FreeMCPair(RF_MCPair_t *t) /* the callback function used to wake you up when you use an mcpair to wait for something */ -void +void rf_MCPairWakeupFunc(RF_MCPair_t *mcpair) { RF_LOCK_MUTEX(mcpair->mutex); diff --git a/sys/dev/raidframe/rf_netbsd.h b/sys/dev/raidframe/rf_netbsd.h index 02abed37612..61034390d1d 100644 --- a/sys/dev/raidframe/rf_netbsd.h +++ b/sys/dev/raidframe/rf_netbsd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.21 2005/01/22 02:22:44 oster Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.22 2005/02/27 00:27:45 perry Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -98,7 +98,7 @@ typedef struct RF_AutoConfig_s { dev_t dev; /* the device for this component */ struct vnode *vp; /* Mr. Vnode Pointer */ RF_ComponentLabel_t *clabel; /* the label */ - struct RF_AutoConfig_s *next; /* the next autoconfig structure + struct RF_AutoConfig_s *next; /* the next autoconfig structure in this set. */ } RF_AutoConfig_t; diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 5490b8a6ec5..3626250b090 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.185 2004/11/17 01:34:10 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.186 2005/02/27 00:27:45 perry 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.185 2004/11/17 01:34:10 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.186 2005/02/27 00:27:45 perry Exp $"); #include <sys/param.h> #include <sys/errno.h> @@ -207,10 +207,10 @@ MALLOC_DEFINE(M_RAIDFRAME, "RAIDframe", "RAIDframe structures"); /* prototypes */ static void KernelWakeupFunc(struct buf * bp); -static void InitBP(struct buf * bp, struct vnode *, unsigned rw_flag, - dev_t dev, RF_SectorNum_t startSect, +static void InitBP(struct buf * bp, struct vnode *, unsigned rw_flag, + dev_t dev, RF_SectorNum_t startSect, RF_SectorCount_t numSect, caddr_t buf, - void (*cbFunc) (struct buf *), void *cbArg, + void (*cbFunc) (struct buf *), void *cbArg, int logBytesPerSector, struct proc * b_proc); static void raidinit(RF_Raid_t *); @@ -246,7 +246,7 @@ struct raidbuf { }; /* XXX Not sure if the following should be replacing the raidPtrs above, - or if it should be used in conjunction with that... + or if it should be used in conjunction with that... */ struct raid_softc { @@ -267,20 +267,20 @@ struct raid_softc { #define raidunit(x) DISKUNIT(x) int numraid = 0; -/* - * Allow RAIDOUTSTANDING number of simultaneous IO's to this RAID device. - * Be aware that large numbers can allow the driver to consume a lot of +/* + * Allow RAIDOUTSTANDING number of simultaneous IO's to this RAID device. + * Be aware that large numbers can allow the driver to consume a lot of * kernel memory, especially on writes, and in degraded mode reads. - * - * For example: with a stripe width of 64 blocks (32k) and 5 disks, - * a single 64K write will typically require 64K for the old data, - * 64K for the old parity, and 64K for the new parity, for a total + * + * For example: with a stripe width of 64 blocks (32k) and 5 disks, + * a single 64K write will typically require 64K for the old data, + * 64K for the old parity, and 64K for the new parity, for a total * of 192K (if the parity buffer is not re-used immediately). * Even it if is used immediately, that's still 128K, which when multiplied * by say 10 requests, is 1280K, *on top* of the 640K of incoming data. - * + * * Now in degraded mode, for example, a 64K read on the above setup may - * require data reconstruction, which will require *all* of the 4 remaining + * require data reconstruction, which will require *all* of the 4 remaining * disks to participate -- 4 * 32K/disk == 128K again. */ @@ -294,7 +294,7 @@ int numraid = 0; /* declared here, and made public, for the benefit of KVM stuff.. */ struct raid_softc *raid_softc; -static void raidgetdefaultlabel(RF_Raid_t *, struct raid_softc *, +static void raidgetdefaultlabel(RF_Raid_t *, struct raid_softc *, struct disklabel *); static void raidgetdisklabel(dev_t); static void raidmakedisklabel(struct raid_softc *); @@ -328,7 +328,7 @@ int rf_auto_config_set(RF_ConfigSet_t *, int *); static int raidautoconfig = 0; /* Debugging, mostly. Set to 0 to not allow autoconfig to take place. Note that this is overridden by having - RAID_AUTOCONFIG as an option in the + RAID_AUTOCONFIG as an option in the kernel config file. */ struct RF_Pools_s rf_pools; @@ -473,7 +473,7 @@ rf_buildroothack(RF_ConfigSet_t *config_sets) cset = config_sets; while(cset != NULL ) { next_cset = cset->next; - if (rf_have_enough_components(cset) && + if (rf_have_enough_components(cset) && cset->ac->clabel->autoconfigure==1) { retcode = rf_auto_config_set(cset,&raidID); if (!retcode) { @@ -489,7 +489,7 @@ rf_buildroothack(RF_ConfigSet_t *config_sets) rf_release_all_vps(cset); } } else { - /* we're not autoconfiguring this set... + /* we're not autoconfiguring this set... release the associated resources */ rf_release_all_vps(cset); } @@ -501,7 +501,7 @@ rf_buildroothack(RF_ConfigSet_t *config_sets) /* we found something bootable... */ if (num_root == 1) { - booted_device = &raidrootdev[rootID]; + booted_device = &raidrootdev[rootID]; } else if (num_root > 1) { /* we can't guess.. require the user to answer... */ boothowto |= RB_ASKNAME; @@ -597,7 +597,7 @@ raidopen(dev_t dev, int flags, int fmt, struct proc *p) break; } - if ((rs->sc_dkdev.dk_openmask == 0) && + if ((rs->sc_dkdev.dk_openmask == 0) && ((rs->sc_flags & RAIDF_INITED) != 0)) { /* First one... mark things as dirty... Note that we *MUST* have done a configure before this. I DO NOT WANT TO BE @@ -650,12 +650,12 @@ raidclose(dev_t dev, int flags, int fmt, struct proc *p) } rs->sc_dkdev.dk_openmask = rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask; - + if ((rs->sc_dkdev.dk_openmask == 0) && ((rs->sc_flags & RAIDF_INITED) != 0)) { - /* Last one... device is not unconfigured yet. - Device shutdown has taken care of setting the - clean bits if RAIDF_INITED is not set + /* Last one... device is not unconfigured yet. + Device shutdown has taken care of setting the + clean bits if RAIDF_INITED is not set mark things as clean... */ rf_update_component_labels(raidPtrs[unit], @@ -664,10 +664,10 @@ raidclose(dev_t dev, int flags, int fmt, struct proc *p) /* last one, and we're going down, so lights out for this RAID set too. */ error = rf_Shutdown(raidPtrs[unit]); - + /* It's no longer initialized... */ rs->sc_flags &= ~RAIDF_INITED; - + /* Detach the disk. */ disk_detach(&rs->sc_dkdev); } @@ -913,7 +913,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) k_cfg->layoutSpecificSize); if (retcode) { RF_Free(k_cfg, sizeof(RF_Config_t)); - RF_Free(specific_buf, + RF_Free(specific_buf, k_cfg->layoutSpecificSize); db1_printf(("rf_ioctl: retcode=%d copyin.2\n", retcode)); @@ -930,8 +930,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* * Clear the entire RAID descriptor, just to make sure - * there is no stale data left in the case of a - * reconfiguration + * there is no stale data left in the case of a + * reconfiguration */ memset((char *) raidPtr, 0, sizeof(RF_Raid_t)); raidPtr->raidid = unit; @@ -940,10 +940,10 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) if (retcode == 0) { - /* allow this many simultaneous IO's to + /* allow this many simultaneous IO's to this RAID device */ raidPtr->openings = RAIDOUTSTANDING; - + raidinit(raidPtr); rf_markalldirty(raidPtr); } @@ -991,7 +991,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* need to read the component label for the disk indicated by row,column in clabel */ - /* For practice, let's get it directly fromdisk, rather + /* For practice, let's get it directly fromdisk, rather than from the in-core copy */ RF_Malloc( clabel, sizeof( RF_ComponentLabel_t ), (RF_ComponentLabel_t *)); @@ -999,8 +999,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return (ENOMEM); memset((char *) clabel, 0, sizeof(RF_ComponentLabel_t)); - - retcode = copyin( *clabel_ptr, clabel, + + retcode = copyin( *clabel_ptr, clabel, sizeof(RF_ComponentLabel_t)); if (retcode) { @@ -1018,8 +1018,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return(EINVAL); } - raidread_component_label(raidPtr->Disks[column].dev, - raidPtr->raid_cinfo[column].ci_vp, + raidread_component_label(raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, clabel ); retcode = copyout(clabel, *clabel_ptr, @@ -1032,7 +1032,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* XXX check the label for valid stuff... */ /* Note that some things *should not* get modified -- - the user should be re-initing the labels instead of + the user should be re-initing the labels instead of trying to patch things. */ @@ -1059,24 +1059,24 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* XXX and before it is, we need to fill in the rest of the fields!?!?!?! */ #if 0 - raidwrite_component_label( - raidPtr->Disks[column].dev, - raidPtr->raid_cinfo[column].ci_vp, + raidwrite_component_label( + raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, clabel ); #endif return (0); - case RAIDFRAME_INIT_LABELS: + case RAIDFRAME_INIT_LABELS: clabel = (RF_ComponentLabel_t *) data; - /* + /* we only want the serial number from the above. We get all the rest of the information from the config that was used to create this RAID - set. + set. */ raidPtr->serial_number = clabel->serial_number; - + raid_init_component_label(raidPtr, &ci_label); ci_label.serial_number = clabel->serial_number; ci_label.row = 0; /* we dont' pretend to support more */ @@ -1086,9 +1086,9 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) 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, + raidwrite_component_label( + raidPtr->Disks[column].dev, + raidPtr->raid_cinfo[column].ci_vp, &ci_label ); } } @@ -1096,14 +1096,14 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return (retcode); case RAIDFRAME_SET_AUTOCONFIG: d = rf_set_autoconfig(raidPtr, *(int *) data); - printf("raid%d: New autoconfig value is: %d\n", + printf("raid%d: New autoconfig value is: %d\n", raidPtr->raidid, d); *(int *) data = d; return (retcode); case RAIDFRAME_SET_ROOT: d = rf_set_rootpartition(raidPtr, *(int *) data); - printf("raid%d: New rootpartition value is: %d\n", + printf("raid%d: New rootpartition value is: %d\n", raidPtr->raidid, d); *(int *) data = d; return (retcode); @@ -1116,7 +1116,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) raidPtr->parity_good = RF_RAID_CLEAN; return(0); } - + if (raidPtr->parity_rewrite_in_progress == 1) { /* Re-write is already in progress! */ return(EINVAL); @@ -1139,14 +1139,14 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case RAIDFRAME_DELETE_COMPONENT: componentPtr = (RF_SingleComponent_t *)data; - memcpy( &component, componentPtr, + memcpy( &component, componentPtr, sizeof(RF_SingleComponent_t)); retcode = rf_delete_component(raidPtr, &component); return(retcode); case RAIDFRAME_INCORPORATE_HOT_SPARE: componentPtr = (RF_SingleComponent_t *)data; - memcpy( &component, componentPtr, + memcpy( &component, componentPtr, sizeof(RF_SingleComponent_t)); retcode = rf_incorporate_hot_spare(raidPtr, &component); return(retcode); @@ -1164,7 +1164,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) } componentPtr = (RF_SingleComponent_t *) data; - memcpy( &component, componentPtr, + memcpy( &component, componentPtr, sizeof(RF_SingleComponent_t)); component.row = 0; /* we don't support any more */ column = component.column; @@ -1175,7 +1175,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) RF_LOCK_MUTEX(raidPtr->mutex); if ((raidPtr->Disks[column].status == rf_ds_optimal) && - (raidPtr->numFailures > 0)) { + (raidPtr->numFailures > 0)) { /* XXX 0 above shouldn't be constant!!! */ /* some component other than this has failed. Let's not make things worse than they already @@ -1187,12 +1187,12 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } - if (raidPtr->Disks[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: Col: %d Reconstruction already occuring!\n", raidPtr->raidid, column); - + RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } @@ -1291,8 +1291,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) RF_UNLOCK_MUTEX(raidPtr->mutex); return (EINVAL); } - if ((raidPtr->Disks[rr->col].status == - rf_ds_optimal) && (raidPtr->numFailures > 0)) { + 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); @@ -1362,9 +1362,9 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) progressInfo.completed = 100; progressInfo.total = 100; } else { - progressInfo.total = + progressInfo.total = raidPtr->reconControl->numRUsTotal; - progressInfo.completed = + progressInfo.completed = raidPtr->reconControl->numRUsComplete; progressInfo.remaining = progressInfo.total - progressInfo.completed; @@ -1381,8 +1381,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return(0); } if (raidPtr->parity_rewrite_in_progress == 1) { - *(int *) data = 100 * - raidPtr->parity_rewrite_stripes_done / + *(int *) data = 100 * + raidPtr->parity_rewrite_stripes_done / raidPtr->Layout.numStripe; } else { *(int *) data = 100; @@ -1393,7 +1393,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) progressInfoPtr = (RF_ProgressInfo_t **) data; if (raidPtr->parity_rewrite_in_progress == 1) { progressInfo.total = raidPtr->Layout.numStripe; - progressInfo.completed = + progressInfo.completed = raidPtr->parity_rewrite_stripes_done; progressInfo.remaining = progressInfo.total - progressInfo.completed; @@ -1424,7 +1424,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) progressInfoPtr = (RF_ProgressInfo_t **) data; if (raidPtr->copyback_in_progress == 1) { progressInfo.total = raidPtr->Layout.numStripe; - progressInfo.completed = + progressInfo.completed = raidPtr->copyback_stripes_done; progressInfo.remaining = progressInfo.total - progressInfo.completed; @@ -1454,7 +1454,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) RF_UNLOCK_MUTEX(rf_sparet_wait_mutex); /* structure assignment */ - *((RF_SparetWait_t *) data) = *waitreq; + *((RF_SparetWait_t *) data) = *waitreq; RF_Free(waitreq, sizeof(*waitreq)); return (0); @@ -1630,13 +1630,13 @@ raidinit(RF_Raid_t *raidPtr) /* wake up the daemon & tell it to get us a spare table * XXX * the entries in the queues should be tagged with the raidPtr - * so that in the extremely rare case that two recons happen at once, + * so that in the extremely rare case that two recons happen at once, * we know for which device were requesting a spare table * XXX - * + * * XXX This code is not currently used. GO */ -int +int rf_GetSpareTableFromDaemon(RF_SparetWait_t *req) { int retcode; @@ -1662,12 +1662,12 @@ rf_GetSpareTableFromDaemon(RF_SparetWait_t *req) } #endif -/* a wrapper around rf_DoAccess that extracts appropriate info from the +/* a wrapper around rf_DoAccess that extracts appropriate info from the * bp & passes it down. * any calls originating in the kernel must use non-blocking I/O * do some extra sanity checking to return "appropriate" error values for * certain conditions (to make some standard utilities work) - * + * * Formerly known as: rf_DoAccessKernel */ void @@ -1685,12 +1685,12 @@ raidstart(RF_Raid_t *raidPtr) unit = raidPtr->raidid; rs = &raid_softc[unit]; - + /* quick check to see if anything has died recently */ RF_LOCK_MUTEX(raidPtr->mutex); if (raidPtr->numNewFailures > 0) { RF_UNLOCK_MUTEX(raidPtr->mutex); - rf_update_component_labels(raidPtr, + rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE); RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->numNewFailures--; @@ -1707,7 +1707,7 @@ raidstart(RF_Raid_t *raidPtr) } /* Ok, for the bp we have here, bp->b_blkno is relative to the - * partition.. Need to make it absolute to the underlying + * partition.. Need to make it absolute to the underlying * device.. */ blocknum = bp->b_blkno; @@ -1716,16 +1716,16 @@ raidstart(RF_Raid_t *raidPtr) blocknum += pp->p_offset; } - db1_printf(("Blocks: %d, %d\n", (int) bp->b_blkno, + db1_printf(("Blocks: %d, %d\n", (int) bp->b_blkno, (int) blocknum)); - + db1_printf(("bp->b_bcount = %d\n", (int) bp->b_bcount)); db1_printf(("bp->b_resid = %d\n", (int) bp->b_resid)); - - /* *THIS* is where we adjust what block we're going to... + + /* *THIS* is where we adjust what block we're going to... * but DO NOT TOUCH bp->b_blkno!!! */ raid_addr = blocknum; - + num_blocks = bp->b_bcount >> raidPtr->logBytesPerSector; pb = (bp->b_bcount & raidPtr->sectorMask) ? 1 : 0; sum = raid_addr + num_blocks + pb; @@ -1746,7 +1746,7 @@ raidstart(RF_Raid_t *raidPtr) /* * XXX rf_DoAccess() should do this, not just DoAccessKernel() */ - + if (bp->b_bcount & raidPtr->sectorMask) { bp->b_error = EINVAL; bp->b_flags |= B_ERROR; @@ -1754,10 +1754,10 @@ raidstart(RF_Raid_t *raidPtr) biodone(bp); RF_LOCK_MUTEX(raidPtr->mutex); continue; - + } db1_printf(("Calling DoAccess..\n")); - + RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->openings--; @@ -1767,15 +1767,15 @@ raidstart(RF_Raid_t *raidPtr) * Everything is async. */ do_async = 1; - + disk_busy(&rs->sc_dkdev); - /* XXX we're still at splbio() here... do we *really* + /* XXX we're still at splbio() here... do we *really* need to be? */ - /* don't ever condition on bp->b_flags & B_WRITE. + /* don't ever condition on bp->b_flags & B_WRITE. * always condition on B_READ instead */ - + rc = rf_DoAccess(raidPtr, (bp->b_flags & B_READ) ? RF_IO_TYPE_READ : RF_IO_TYPE_WRITE, do_async, raid_addr, num_blocks, @@ -1787,7 +1787,7 @@ raidstart(RF_Raid_t *raidPtr) bp->b_resid = bp->b_bcount; biodone(bp); /* continue loop */ - } + } RF_LOCK_MUTEX(raidPtr->mutex); } @@ -1799,7 +1799,7 @@ raidstart(RF_Raid_t *raidPtr) /* invoke an I/O from kernel mode. Disk queue should be locked upon entry */ -int +int rf_DispatchKernelIO(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req) { int op = (req->type == RF_IO_TYPE_READ) ? B_READ : B_WRITE; @@ -1883,7 +1883,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req) queue->curPriority = req->priority; db1_printf(("Going for %c to unit %d col %d\n", - req->type, queue->raidPtr->raidid, + req->type, queue->raidPtr->raidid, queue->col)); db1_printf(("sector %d count %d (%d bytes) %d\n", (int) req->sectorOffset, (int) req->numSector, @@ -1907,7 +1907,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req) /* this is the callback function associated with a I/O invoked from kernel code. */ -static void +static void KernelWakeupFunc(struct buf *vbp) { RF_DiskQueueData_t *req = NULL; @@ -1953,10 +1953,10 @@ KernelWakeupFunc(struct buf *vbp) if (bp->b_flags & B_ERROR) { /* Mark the disk as dead */ /* but only mark it once... */ - /* and only if it wouldn't leave this RAID set + /* and only if it wouldn't leave this RAID set completely broken */ if ((queue->raidPtr->Disks[queue->col].status == - rf_ds_optimal) && (queue->raidPtr->numFailures < + rf_ds_optimal) && (queue->raidPtr->numFailures < queue->raidPtr->Layout.map->faultsTolerated)) { printf("raid%d: IO Error. Marking %s as failed.\n", queue->raidPtr->raidid, @@ -1996,7 +1996,7 @@ KernelWakeupFunc(struct buf *vbp) /* * initialize a buf structure for doing an I/O in the kernel. */ -static void +static void InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev, RF_SectorNum_t startSect, RF_SectorCount_t numSect, caddr_t buf, void (*cbFunc) (struct buf *), void *cbArg, int logBytesPerSector, @@ -2021,7 +2021,7 @@ InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev, } static void -raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, +raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, struct disklabel *lp) { memset(lp, 0, sizeof(*lp)); @@ -2031,7 +2031,7 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, lp->d_secsize = raidPtr->bytesPerSector; lp->d_nsectors = raidPtr->Layout.dataSectorsPerStripe; lp->d_ntracks = 4 * raidPtr->numCol; - lp->d_ncylinders = raidPtr->totalSectors / + lp->d_ncylinders = raidPtr->totalSectors / (lp->d_nsectors * lp->d_ntracks); lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors; @@ -2102,7 +2102,7 @@ raidgetdisklabel(dev_t dev) pp = &lp->d_partitions[i]; if (pp->p_offset + pp->p_size > rs->sc_size) printf("raid%d: WARNING: %s: end of partition `%c' " - "exceeds the size of raid (%ld)\n", + "exceeds the size of raid (%ld)\n", unit, rs->sc_xname, 'a' + i, (long) rs->sc_size); } } @@ -2202,12 +2202,12 @@ raidunlock(struct raid_softc *rs) wakeup(rs); } } - + #define RF_COMPONENT_INFO_OFFSET 16384 /* bytes */ #define RF_COMPONENT_INFO_SIZE 1024 /* bytes */ -int +int raidmarkclean(dev_t dev, struct vnode *b_vp, int mod_counter) { RF_ComponentLabel_t clabel; @@ -2219,7 +2219,7 @@ raidmarkclean(dev_t dev, struct vnode *b_vp, int mod_counter) } -int +int raidmarkdirty(dev_t dev, struct vnode *b_vp, int mod_counter) { RF_ComponentLabel_t clabel; @@ -2232,15 +2232,15 @@ raidmarkdirty(dev_t dev, struct vnode *b_vp, int mod_counter) /* ARGSUSED */ int -raidread_component_label(dev_t dev, struct vnode *b_vp, +raidread_component_label(dev_t dev, struct vnode *b_vp, RF_ComponentLabel_t *clabel) { struct buf *bp; const struct bdevsw *bdev; int error; - + /* XXX should probably ensure that we don't try to do this if - someone has changed rf_protected_sectors. */ + someone has changed rf_protected_sectors. */ if (b_vp == NULL) { /* For whatever reason, this component is not valid. @@ -2263,19 +2263,19 @@ raidread_component_label(dev_t dev, struct vnode *b_vp, return (ENXIO); (*bdev->d_strategy)(bp); - error = biowait(bp); + error = biowait(bp); if (!error) { memcpy(clabel, bp->b_data, sizeof(RF_ComponentLabel_t)); - } + } - brelse(bp); + brelse(bp); return(error); } /* ARGSUSED */ -int -raidwrite_component_label(dev_t dev, struct vnode *b_vp, +int +raidwrite_component_label(dev_t dev, struct vnode *b_vp, RF_ComponentLabel_t *clabel) { struct buf *bp; @@ -2300,7 +2300,7 @@ raidwrite_component_label(dev_t dev, struct vnode *b_vp, if (bdev == NULL) return (ENXIO); (*bdev->d_strategy)(bp); - error = biowait(bp); + error = biowait(bp); brelse(bp); if (error) { #if 1 @@ -2311,7 +2311,7 @@ raidwrite_component_label(dev_t dev, struct vnode *b_vp, return(error); } -void +void rf_markalldirty(RF_Raid_t *raidPtr) { RF_ComponentLabel_t clabel; @@ -2330,26 +2330,26 @@ rf_markalldirty(RF_Raid_t *raidPtr) raidPtr->raid_cinfo[c].ci_vp, &clabel); if (clabel.status == rf_ds_spared) { - /* XXX do something special... - but whatever you do, don't + /* XXX do something special... + but whatever you do, don't try to access it!! */ } else { - raidmarkdirty( + 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[sparecol].status == rf_ds_used_spare) { - /* - - we claim this disk is "optimal" if it's - rf_ds_used_spare, as that means it should be - directly substitutable for the disk it replaced. + /* + + we claim this disk is "optimal" if it's + rf_ds_used_spare, as that means it should be + directly substitutable for the disk it replaced. We note that too... */ @@ -2360,8 +2360,8 @@ rf_markalldirty(RF_Raid_t *raidPtr) break; } } - - raidread_component_label( + + raidread_component_label( raidPtr->Disks[sparecol].dev, raidPtr->raid_cinfo[sparecol].ci_vp, &clabel); @@ -2374,7 +2374,7 @@ rf_markalldirty(RF_Raid_t *raidPtr) /* Note: we *don't* change status from rf_ds_used_spare to rf_ds_optimal */ /* clabel.status = rf_ds_optimal; */ - + raidmarkdirty(raidPtr->Disks[sparecol].dev, raidPtr->raid_cinfo[sparecol].ci_vp, raidPtr->mod_counter); @@ -2394,7 +2394,7 @@ rf_update_component_labels(RF_Raid_t *raidPtr, int final) scol = -1; - /* XXX should do extra checks to make sure things really are clean, + /* XXX should do extra checks to make sure things really are clean, rather than blindly setting the clean bit... */ raidPtr->mod_counter++; @@ -2410,31 +2410,31 @@ rf_update_component_labels(RF_Raid_t *raidPtr, int final) /* bump the counter */ clabel.mod_counter = raidPtr->mod_counter; - raidwrite_component_label( + 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, + raidmarkclean( + raidPtr->Disks[c].dev, raidPtr->raid_cinfo[c].ci_vp, raidPtr->mod_counter); } } - } + } /* 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[sparecol].status == rf_ds_used_spare) { - /* - - we claim this disk is "optimal" if it's - rf_ds_used_spare, as that means it should be - directly substitutable for the disk it replaced. + /* + + we claim this disk is "optimal" if it's + rf_ds_used_spare, as that means it should be + directly substitutable for the disk it replaced. We note that too... */ @@ -2445,9 +2445,9 @@ rf_update_component_labels(RF_Raid_t *raidPtr, int final) break; } } - + /* XXX shouldn't *really* need this... */ - raidread_component_label( + raidread_component_label( raidPtr->Disks[sparecol].dev, raidPtr->raid_cinfo[sparecol].ci_vp, &clabel); @@ -2486,18 +2486,18 @@ rf_close_component(RF_Raid_t *raidPtr, struct vnode *vp, int auto_configured) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0); vput(vp); - - } else { + + } else { (void) vn_close(vp, FREAD | FWRITE, p->p_ucred, p); } - } + } } void rf_UnconfigureVnodes(RF_Raid_t *raidPtr) { - int r,c; + int r,c; struct vnode *vp; int acd; @@ -2522,7 +2522,7 @@ rf_UnconfigureVnodes(RF_Raid_t *raidPtr) } -void +void rf_ReconThread(struct rf_recon_req *req) { int s; @@ -2596,7 +2596,7 @@ rf_ReconstructInPlaceThread(struct rf_recon_req *req) { int s; RF_Raid_t *raidPtr; - + s = splbio(); raidPtr = req->raidPtr; raidPtr->recon_in_progress = 1; @@ -2655,7 +2655,7 @@ rf_find_raid_components() if (!strcmp(dv->dv_cfdata->cf_name,"fdisa")) { continue; } - + /* need to find the device_name_to_block_device_major stuff */ bmajor = devsw_name2blk(dv->dv_xname, NULL, 0); @@ -2668,7 +2668,7 @@ rf_find_raid_components() error = VOP_OPEN(vp, FREAD, NOCRED, 0); if (error) { - /* "Who cares." Continue looking + /* "Who cares." Continue looking for something that exists*/ vput(vp); continue; @@ -2713,8 +2713,8 @@ rf_find_raid_components() good_one = 0; - clabel = (RF_ComponentLabel_t *) - malloc(sizeof(RF_ComponentLabel_t), + clabel = (RF_ComponentLabel_t *) + malloc(sizeof(RF_ComponentLabel_t), M_RAIDFRAME, M_NOWAIT); if (clabel == NULL) { /* XXX CLEANUP HERE */ @@ -2725,15 +2725,15 @@ rf_find_raid_components() if (!raidread_component_label(dev, vp, clabel)) { /* Got the label. Does it look reasonable? */ if (rf_reasonable_label(clabel) && - (clabel->partitionSize <= + (clabel->partitionSize <= label.d_partitions[i].p_size)) { #if DEBUG - printf("Component on: %s%c: %d\n", + printf("Component on: %s%c: %d\n", dv->dv_xname, 'a'+i, label.d_partitions[i].p_size); rf_print_component_label(clabel); #endif - /* if it's reasonable, add it, + /* if it's reasonable, add it, else ignore it. */ ac = (RF_AutoConfig_t *) malloc(sizeof(RF_AutoConfig_t), @@ -2743,7 +2743,7 @@ rf_find_raid_components() /* XXX should panic?? */ return(NULL); } - + snprintf(ac->devname, sizeof(ac->devname), "%s%c", dv->dv_xname, 'a'+i); @@ -2753,7 +2753,7 @@ rf_find_raid_components() ac->next = ac_list; ac_list = ac; good_one = 1; - } + } } if (!good_one) { /* cleanup */ @@ -2766,20 +2766,20 @@ rf_find_raid_components() } return(ac_list); } - + static int rf_reasonable_label(RF_ComponentLabel_t *clabel) { - + if (((clabel->version==RF_COMPONENT_LABEL_VERSION_1) || (clabel->version==RF_COMPONENT_LABEL_VERSION)) && ((clabel->clean == RF_RAID_CLEAN) || (clabel->clean == RF_RAID_DIRTY)) && - clabel->row >=0 && - clabel->column >= 0 && + clabel->row >=0 && + clabel->column >= 0 && clabel->num_rows > 0 && clabel->num_columns > 0 && - clabel->row < clabel->num_rows && + clabel->row < clabel->num_rows && clabel->column < clabel->num_columns && clabel->blockSize > 0 && clabel->numBlocks > 0) { @@ -2795,7 +2795,7 @@ void rf_print_component_label(RF_ComponentLabel_t *clabel) { printf(" Row: %d Column: %d Num Rows: %d Num Columns: %d\n", - clabel->row, clabel->column, + clabel->row, clabel->column, clabel->num_rows, clabel->num_columns); printf(" Version: %d Serial Number: %d Mod Counter: %d\n", clabel->version, clabel->serial_number, @@ -2805,16 +2805,16 @@ rf_print_component_label(RF_ComponentLabel_t *clabel) printf(" sectPerSU: %d SUsPerPU: %d SUsPerRU: %d\n", clabel->sectPerSU, clabel->SUsPerPU, clabel->SUsPerRU); printf(" RAID Level: %c blocksize: %d numBlocks: %d\n", - (char) clabel->parityConfig, clabel->blockSize, + (char) clabel->parityConfig, clabel->blockSize, clabel->numBlocks); printf(" Autoconfig: %s\n", clabel->autoconfigure ? "Yes" : "No" ); - printf(" Contains root partition: %s\n", + printf(" Contains root partition: %s\n", clabel->root_partition ? "Yes" : "No" ); printf(" Last configured as: raid%d\n", clabel->last_unit ); #if 0 printf(" Config order: %d\n", clabel->config_order); #endif - + } #endif @@ -2840,7 +2840,7 @@ rf_create_auto_sets(RF_AutoConfig_t *ac_list) if (config_sets == NULL) { /* will need at least this one... */ config_sets = (RF_ConfigSet_t *) - malloc(sizeof(RF_ConfigSet_t), + malloc(sizeof(RF_ConfigSet_t), M_RAIDFRAME, M_NOWAIT); if (config_sets == NULL) { panic("rf_create_auto_sets: No memory!"); @@ -2865,7 +2865,7 @@ rf_create_auto_sets(RF_AutoConfig_t *ac_list) if (cset==NULL) { /* didn't find a match above... new set..*/ cset = (RF_ConfigSet_t *) - malloc(sizeof(RF_ConfigSet_t), + malloc(sizeof(RF_ConfigSet_t), M_RAIDFRAME, M_NOWAIT); if (cset == NULL) { panic("rf_create_auto_sets: No memory!"); @@ -2895,9 +2895,9 @@ rf_does_it_fit(RF_ConfigSet_t *cset, RF_AutoConfig_t *ac) /* note that we are not checking partitionSize here.. Note that we are also not checking the mod_counters here. - If everything else matches execpt the mod_counter, that's + If everything else matches execpt the mod_counter, that's good enough for this test. We will deal with the mod_counters - a little later in the autoconfiguration process. + a little later in the autoconfiguration process. (clabel1->mod_counter == clabel2->mod_counter) && @@ -2933,7 +2933,7 @@ rf_does_it_fit(RF_ConfigSet_t *cset, RF_AutoConfig_t *ac) (clabel1->config_order == clabel2->config_order)) { /* if it get's here, it almost *has* to be a match */ } else { - /* it's not consistent with somebody in the set.. + /* it's not consistent with somebody in the set.. punt */ return(0); } @@ -2954,7 +2954,7 @@ rf_have_enough_components(RF_ConfigSet_t *cset) int mod_counter_found; int even_pair_failed; char parity_type; - + /* check to see that we have enough 'live' components of this set. If so, we can configure it if necessary */ @@ -2988,7 +2988,7 @@ rf_have_enough_components(RF_ConfigSet_t *cset) for(c=0; c<num_cols; c++) { ac = auto_config; while(ac!=NULL) { - if ((ac->clabel->column == c) && + if ((ac->clabel->column == c) && (ac->clabel->mod_counter == mod_counter)) { /* it's this one... */ #if DEBUG @@ -3024,7 +3024,7 @@ rf_have_enough_components(RF_ConfigSet_t *cset) } if ((parity_type == '1') && (c%2 == 1)) { /* Just did an even component, and we didn't - bail.. reset the even_pair_failed flag, + bail.. reset the even_pair_failed flag, and go on to the next component.... */ even_pair_failed = 0; } @@ -3148,7 +3148,7 @@ void rf_release_all_vps(RF_ConfigSet_t *cset) { RF_AutoConfig_t *ac; - + ac = cset->ac; while(ac!=NULL) { /* Close the vp, and give it back */ @@ -3168,7 +3168,7 @@ rf_cleanup_config_set(RF_ConfigSet_t *cset) { RF_AutoConfig_t *ac; RF_AutoConfig_t *next_ac; - + ac = cset->ac; while(ac!=NULL) { next_ac = ac->next; @@ -3188,14 +3188,14 @@ void raid_init_component_label(RF_Raid_t *raidPtr, RF_ComponentLabel_t *clabel) { /* current version number */ - clabel->version = RF_COMPONENT_LABEL_VERSION; + clabel->version = RF_COMPONENT_LABEL_VERSION; clabel->serial_number = raidPtr->serial_number; clabel->mod_counter = raidPtr->mod_counter; clabel->num_rows = 1; clabel->num_columns = raidPtr->numCol; clabel->clean = RF_RAID_DIRTY; /* not clean */ clabel->status = rf_ds_optimal; /* "It's good!" */ - + clabel->sectPerSU = raidPtr->Layout.sectorsPerStripeUnit; clabel->SUsPerPU = raidPtr->Layout.SUsPerPU; clabel->SUsPerRU = raidPtr->Layout.SUsPerRU; @@ -3240,10 +3240,10 @@ rf_auto_config_set(RF_ConfigSet_t *cset, int *unit) memset(config, 0, sizeof(RF_Config_t)); - /* - 2. Figure out what RAID ID this one is supposed to live at + /* + 2. Figure out what RAID ID this one is supposed to live at See if we can get the same RAID dev that it was configured - on last time.. + on last time.. */ raidID = cset->ac->clabel->last_unit; @@ -3253,10 +3253,10 @@ rf_auto_config_set(RF_ConfigSet_t *cset, int *unit) } if (raidPtrs[raidID]->valid != 0) { - /* - Nope... Go looking for an alternative... + /* + Nope... Go looking for an alternative... Start high so we don't immediately use raid0 if that's - not taken. + not taken. */ for(raidID = numraid - 1; raidID >= 0; raidID--) { @@ -3289,7 +3289,7 @@ rf_auto_config_set(RF_ConfigSet_t *cset, int *unit) /* 4. Do the configuration */ retcode = rf_Configure(raidPtr, config, cset->ac); - + if (retcode == 0) { raidinit(raidPtrs[raidID]); @@ -3301,13 +3301,13 @@ rf_auto_config_set(RF_ConfigSet_t *cset, int *unit) that this set is eligible to be root. */ cset->rootable = 1; /* XXX do this here? */ - raidPtrs[raidID]->root_partition = 1; + raidPtrs[raidID]->root_partition = 1; } } /* 5. Cleanup */ free(config, M_RAIDFRAME); - + *unit = raidID; return(retcode); } @@ -3318,15 +3318,15 @@ rf_disk_unbusy(RF_RaidAccessDesc_t *desc) struct buf *bp; bp = (struct buf *)desc->bp; - disk_unbusy(&raid_softc[desc->raidPtr->raidid].sc_dkdev, + disk_unbusy(&raid_softc[desc->raidPtr->raidid].sc_dkdev, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); } void -rf_pool_init(struct pool *p, size_t size, char *w_chan, +rf_pool_init(struct pool *p, size_t size, char *w_chan, size_t min, size_t max) { - pool_init(p, size, 0, 0, 0, w_chan, NULL); + pool_init(p, size, 0, 0, 0, w_chan, NULL); pool_sethiwat(p, max); pool_prime(p, min); pool_setlowat(p, min); diff --git a/sys/dev/raidframe/rf_nwayxor.c b/sys/dev/raidframe/rf_nwayxor.c index b172917768a..a430f9859b3 100644 --- a/sys/dev/raidframe/rf_nwayxor.c +++ b/sys/dev/raidframe/rf_nwayxor.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_nwayxor.c,v 1.7 2004/02/29 04:03:50 oster Exp $ */ +/* $NetBSD: rf_nwayxor.c,v 1.8 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,7 +36,7 @@ ************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_nwayxor.c,v 1.7 2004/02/29 04:03:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_nwayxor.c,v 1.8 2005/02/27 00:27:45 perry Exp $"); #include "rf_nwayxor.h" #include "rf_shutdown.h" @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_nwayxor.c,v 1.7 2004/02/29 04:03:50 oster Exp $") static int callcount[10]; static void rf_ShutdownNWayXor(void *); -static void +static void rf_ShutdownNWayXor(void *ignored) { int i; @@ -57,7 +57,7 @@ rf_ShutdownNWayXor(void *ignored) printf("\n"); } -int +int rf_ConfigureNWayXor(RF_ShutdownList_t **listp) { int i; @@ -68,7 +68,7 @@ rf_ConfigureNWayXor(RF_ShutdownList_t **listp) return (0); } -void +void rf_nWayXor1(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *src = (unsigned long *) src_rbs[0]->buffer; @@ -99,7 +99,7 @@ rf_nWayXor1(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor2(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -189,7 +189,7 @@ rf_nWayXor2(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) _dst += 4; -void +void rf_nWayXor3(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -216,7 +216,7 @@ rf_nWayXor3(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor4(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -245,7 +245,7 @@ rf_nWayXor4(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor5(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -276,7 +276,7 @@ rf_nWayXor5(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor6(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -309,7 +309,7 @@ rf_nWayXor6(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor7(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -344,7 +344,7 @@ rf_nWayXor7(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } } -void +void rf_nWayXor8(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; @@ -382,7 +382,7 @@ rf_nWayXor8(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) } -void +void rf_nWayXor9(RF_ReconBuffer_t **src_rbs, RF_ReconBuffer_t *dest_rb, int len) { unsigned long *dst = (unsigned long *) dest_rb->buffer; diff --git a/sys/dev/raidframe/rf_options.c b/sys/dev/raidframe/rf_options.c index 4443190448b..547496a0960 100644 --- a/sys/dev/raidframe/rf_options.c +++ b/sys/dev/raidframe/rf_options.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_options.c,v 1.5 2001/11/13 07:11:15 lukem Exp $ */ +/* $NetBSD: rf_options.c,v 1.6 2005/02/27 00:27:45 perry Exp $ */ /* * rf_options.c */ @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_options.c,v 1.5 2001/11/13 07:11:15 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_options.c,v 1.6 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -71,7 +71,7 @@ RF_DebugName_t rf_debugNames[] = { #define RF_DBG_OPTION(_option_,_defval_) rf_/**/_option_ = _defval_ ; #endif /* __STDC__ */ -void +void rf_ResetDebugOptions() { #include "rf_optnames.h" diff --git a/sys/dev/raidframe/rf_paritylog.c b/sys/dev/raidframe/rf_paritylog.c index 8b7069ab8cd..788c93240c5 100644 --- a/sys/dev/raidframe/rf_paritylog.c +++ b/sys/dev/raidframe/rf_paritylog.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritylog.c,v 1.9 2002/09/14 17:53:58 oster Exp $ */ +/* $NetBSD: rf_paritylog.c,v 1.10 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.9 2002/09/14 17:53:58 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.10 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -87,7 +87,7 @@ AllocParityLogCommonData(RF_Raid_t * raidPtr) return (common); } -static void +static void FreeParityLogCommonData(RF_CommonLogData_t * common) { RF_Raid_t *raidPtr; @@ -127,7 +127,7 @@ AllocParityLogData(RF_Raid_t * raidPtr) } -static void +static void FreeParityLogData(RF_ParityLogData_t * data) { RF_ParityLogData_t *nextItem; @@ -149,7 +149,7 @@ FreeParityLogData(RF_ParityLogData_t * data) } -static void +static void EnqueueParityLogData( RF_ParityLogData_t * data, RF_ParityLogData_t ** head, @@ -227,7 +227,7 @@ DequeueParityLogData( } -static void +static void RequeueParityLogData( RF_ParityLogData_t * data, RF_ParityLogData_t ** head, @@ -279,7 +279,7 @@ rf_CreateParityLogData( /* Return an initialized struct of info to be logged. Build one item * per physical disk address, one item per region. - * + * * NON-BLOCKING */ diskAddress = pda; @@ -349,7 +349,7 @@ rf_SearchAndDequeueParityLogData( /* Remove and return an in-core parity log from a specified region * (regionID). If a matching log is not found, return NULL. - * + * * NON-BLOCKING. */ /* walk backward through a list, looking for an entry with a matching @@ -413,7 +413,7 @@ DequeueMatchingLogData( /* Remove and return an in-core parity log from the tail of a disk * queue (*head, *tail). Then remove all matching (identical * regionIDs) logData and return as a linked list. - * + * * NON-BLOCKING */ logDataList = DequeueParityLogData(raidPtr, head, tail, RF_TRUE); @@ -466,7 +466,7 @@ AcquireParityLog( return (log); } -void +void rf_ReleaseParityLogs( RF_Raid_t * raidPtr, RF_ParityLog_t * firstLog) @@ -477,7 +477,7 @@ rf_ReleaseParityLogs( /* Insert a linked list of parity logs (firstLog) to the free list * (parityLogPool.parityLogPool) - * + * * NON-BLOCKING. */ RF_ASSERT(firstLog); @@ -540,7 +540,7 @@ rf_ReleaseParityLogs( RF_UNLOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); } -static void +static void ReintLog( RF_Raid_t * raidPtr, int regionID, @@ -568,7 +568,7 @@ ReintLog( RF_SIGNAL_COND(raidPtr->parityLogDiskQueue.cond); } -static void +static void FlushLog( RF_Raid_t * raidPtr, RF_ParityLog_t * log) @@ -588,7 +588,7 @@ FlushLog( RF_SIGNAL_COND(raidPtr->parityLogDiskQueue.cond); } -static int +static int DumpParityLogToDisk( int finish, RF_ParityLogData_t * logData) @@ -601,13 +601,13 @@ DumpParityLogToDisk( /* Move a core log to disk. If the log disk is full, initiate * reintegration. - * + * * Return (0) if we can enqueue the dump immediately, otherwise return * (1) to indicate we are blocked on reintegration and control of the * thread should be relinquished. - * + * * Caller must hold regionInfo[regionID].mutex - * + * * NON-BLOCKING */ if (rf_parityLogDebug) @@ -659,7 +659,7 @@ DumpParityLogToDisk( return (0); } -int +int rf_ParityLogAppend( RF_ParityLogData_t * logData, int finish, @@ -678,16 +678,16 @@ rf_ParityLogAppend( /* Add parity to the appropriate log, one sector at a time. This * routine is called is called by dag functions ParityLogUpdateFunc * and ParityLogOverwriteFunc and therefore MUST BE NONBLOCKING. - * + * * Parity to be logged is contained in a linked-list (logData). When * this routine returns, every sector in the list will be in one of * three places: 1) entered into the parity log 2) queued, waiting on * reintegration 3) queued, waiting on a core log - * + * * Blocked work is passed to the ParityLoggingDiskManager for completion. * Later, as conditions which required the block are removed, the work * reenters this routine with the "finish" parameter set to "RF_TRUE." - * + * * NON-BLOCKING */ raidPtr = logData->common->raidPtr; @@ -855,7 +855,7 @@ rf_ParityLogAppend( } -void +void rf_EnableParityLogging(RF_Raid_t * raidPtr) { int regionID; diff --git a/sys/dev/raidframe/rf_paritylogDiskMgr.c b/sys/dev/raidframe/rf_paritylogDiskMgr.c index dcc877c17c0..867884893ef 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.16 2004/01/10 00:56:28 oster Exp $ */ +/* $NetBSD: rf_paritylogDiskMgr.c,v 1.17 2005/02/27 00:27:45 perry 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.16 2004/01/10 00:56:28 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.17 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -59,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.16 2004/01/10 00:56:28 ost static caddr_t AcquireReintBuffer(RF_RegionBufferQueue_t *); -static caddr_t +static caddr_t AcquireReintBuffer(pool) RF_RegionBufferQueue_t *pool; { @@ -84,7 +84,7 @@ AcquireReintBuffer(pool) return (bufPtr); } -static void +static void ReleaseReintBuffer( RF_RegionBufferQueue_t * pool, caddr_t bufPtr) @@ -105,7 +105,7 @@ ReleaseReintBuffer( -static void +static void ReadRegionLog( RF_RegionId_t regionID, RF_MCPair_t * rrd_mcpair, @@ -117,7 +117,7 @@ ReadRegionLog( { /* Initiate the read a region log from disk. Once initiated, return * to the calling routine. - * + * * NON-BLOCKING */ RF_AccTraceEntry_t *tracerec; @@ -125,10 +125,10 @@ ReadRegionLog( /* create DAG to read region log from disk */ rf_MakeAllocList(*rrd_alloclist); - *rrd_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, regionBuffer, + *rrd_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, regionBuffer, rf_DiskReadFunc, rf_DiskReadUndoFunc, - "Rrl", *rrd_alloclist, - RF_DAG_FLAGS_NONE, + "Rrl", *rrd_alloclist, + RF_DAG_FLAGS_NONE, RF_IO_NORMAL_PRIORITY); /* create and initialize PDA for the core log */ @@ -160,7 +160,7 @@ ReadRegionLog( -static void +static void WriteCoreLog( RF_ParityLog_t * log, RF_MCPair_t * fwr_mcpair, @@ -176,12 +176,12 @@ WriteCoreLog( /* Initiate the write of a core log to a region log disk. Once * initiated, return to the calling routine. - * + * * NON-BLOCKING */ /* create DAG to write a core log to a region log disk */ rf_MakeAllocList(*fwr_alloclist); - *fwr_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, log->bufPtr, + *fwr_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, log->bufPtr, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, "Wcl", *fwr_alloclist, RF_DAG_FLAGS_NONE, RF_IO_NORMAL_PRIORITY); @@ -190,8 +190,8 @@ WriteCoreLog( * *)); */ *fwr_pda = rf_AllocPDAList(1); regionOffset = log->diskOffset; - rf_MapLogParityLogging(raidPtr, regionID, regionOffset, - &((*fwr_pda)->col), + rf_MapLogParityLogging(raidPtr, regionID, regionOffset, + &((*fwr_pda)->col), &((*fwr_pda)->startSector)); (*fwr_pda)->numSector = raidPtr->numSectorsPerLog; @@ -211,7 +211,7 @@ WriteCoreLog( } -static void +static void ReadRegionParity( RF_RegionId_t regionID, RF_MCPair_t * prd_mcpair, @@ -223,7 +223,7 @@ ReadRegionParity( { /* Initiate the read region parity from disk. Once initiated, return * to the calling routine. - * + * * NON-BLOCKING */ RF_AccTraceEntry_t *tracerec; @@ -231,9 +231,9 @@ ReadRegionParity( /* create DAG to read region parity from disk */ rf_MakeAllocList(*prd_alloclist); - *prd_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, NULL, rf_DiskReadFunc, - rf_DiskReadUndoFunc, "Rrp", - *prd_alloclist, RF_DAG_FLAGS_NONE, + *prd_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, NULL, rf_DiskReadFunc, + rf_DiskReadUndoFunc, "Rrp", + *prd_alloclist, RF_DAG_FLAGS_NONE, RF_IO_NORMAL_PRIORITY); /* create and initialize PDA for region parity */ @@ -241,7 +241,7 @@ ReadRegionParity( * *)); */ *prd_pda = rf_AllocPDAList(1); rf_MapRegionParity(raidPtr, regionID, - &((*prd_pda)->col), &((*prd_pda)->startSector), + &((*prd_pda)->col), &((*prd_pda)->startSector), &((*prd_pda)->numSector)); if (rf_parityLogDebug) printf("[reading %d sectors of parity from region %d]\n", @@ -268,7 +268,7 @@ ReadRegionParity( (void *) prd_mcpair); } -static void +static void WriteRegionParity( RF_RegionId_t regionID, RF_MCPair_t * pwr_mcpair, @@ -280,7 +280,7 @@ WriteRegionParity( { /* Initiate the write of region parity to disk. Once initiated, return * to the calling routine. - * + * * NON-BLOCKING */ RF_AccTraceEntry_t *tracerec; @@ -288,10 +288,10 @@ WriteRegionParity( /* create DAG to write region log from disk */ rf_MakeAllocList(*pwr_alloclist); - *pwr_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, parityBuffer, + *pwr_dag_h = rf_MakeSimpleDAG(raidPtr, 1, 0, parityBuffer, rf_DiskWriteFunc, rf_DiskWriteUndoFunc, - "Wrp", *pwr_alloclist, - RF_DAG_FLAGS_NONE, + "Wrp", *pwr_alloclist, + RF_DAG_FLAGS_NONE, RF_IO_NORMAL_PRIORITY); /* create and initialize PDA for region parity */ @@ -299,7 +299,7 @@ WriteRegionParity( * *)); */ *pwr_pda = rf_AllocPDAList(1); rf_MapRegionParity(raidPtr, regionID, - &((*pwr_pda)->col), &((*pwr_pda)->startSector), + &((*pwr_pda)->col), &((*pwr_pda)->startSector), &((*pwr_pda)->numSector)); /* initialize DAG parameters */ @@ -317,7 +317,7 @@ WriteRegionParity( (void *) pwr_mcpair); } -static void +static void FlushLogsToDisk( RF_Raid_t * raidPtr, RF_ParityLog_t * logList) @@ -325,10 +325,10 @@ FlushLogsToDisk( /* Flush a linked list of core logs to the log disk. Logs contain the * disk location where they should be written. Logs were written in * FIFO order and that order must be preserved. - * + * * Recommended optimizations: 1) allow multiple flushes to occur * simultaneously 2) coalesce contiguous flush operations - * + * * BLOCKING */ RF_ParityLog_t *log; @@ -350,7 +350,7 @@ FlushLogsToDisk( if (rf_parityLogDebug) printf("[initiating write of core log for region %d]\n", regionID); fwr_mcpair->flag = RF_FALSE; - WriteCoreLog(log, fwr_mcpair, raidPtr, &fwr_dag_h, + WriteCoreLog(log, fwr_mcpair, raidPtr, &fwr_dag_h, &fwr_alloclist, &fwr_pda); /* wait for the DAG to complete */ @@ -372,7 +372,7 @@ FlushLogsToDisk( rf_ReleaseParityLogs(raidPtr, logList); } -static void +static void ReintegrateRegion( RF_Raid_t * raidPtr, RF_RegionId_t regionID, @@ -384,15 +384,15 @@ ReintegrateRegion( RF_PhysDiskAddr_t *rrd_pda, *prd_pda, *pwr_pda; caddr_t parityBuffer, regionBuffer = NULL; - /* Reintegrate a region (regionID). + /* Reintegrate a region (regionID). * - * 1. acquire region and parity buffers - * 2. read log from disk - * 3. read parity from disk - * 4. apply log to parity - * 5. apply core log to parity + * 1. acquire region and parity buffers + * 2. read log from disk + * 3. read parity from disk + * 4. apply log to parity + * 5. apply core log to parity * 6. write new parity to disk - * + * * BLOCKING */ if (rf_parityLogDebug) @@ -405,7 +405,7 @@ ReintegrateRegion( prd_mcpair = rf_AllocMCPair(); RF_LOCK_MUTEX(prd_mcpair->mutex); prd_mcpair->flag = RF_FALSE; - ReadRegionParity(regionID, prd_mcpair, parityBuffer, raidPtr, + ReadRegionParity(regionID, prd_mcpair, parityBuffer, raidPtr, &prd_dag_h, &prd_alloclist, &prd_pda); /* if region log nonempty, initiate read */ @@ -417,7 +417,7 @@ ReintegrateRegion( rrd_mcpair = rf_AllocMCPair(); RF_LOCK_MUTEX(rrd_mcpair->mutex); rrd_mcpair->flag = RF_FALSE; - ReadRegionLog(regionID, rrd_mcpair, regionBuffer, raidPtr, + ReadRegionLog(regionID, rrd_mcpair, regionBuffer, raidPtr, &rrd_dag_h, &rrd_alloclist, &rrd_pda); } /* wait on read of region parity to complete */ @@ -460,7 +460,7 @@ ReintegrateRegion( pwr_mcpair = rf_AllocMCPair(); RF_LOCK_MUTEX(pwr_mcpair->mutex); pwr_mcpair->flag = RF_FALSE; - WriteRegionParity(regionID, pwr_mcpair, parityBuffer, raidPtr, + WriteRegionParity(regionID, pwr_mcpair, parityBuffer, raidPtr, &pwr_dag_h, &pwr_alloclist, &pwr_pda); while (!pwr_mcpair->flag) RF_WAIT_COND(pwr_mcpair->cond, pwr_mcpair->mutex); @@ -491,7 +491,7 @@ ReintegrateRegion( -static void +static void ReintegrateLogs( RF_Raid_t * raidPtr, RF_ParityLog_t * logList) @@ -512,16 +512,16 @@ ReintegrateLogs( /* remove all items which are blocked on reintegration of this * region */ RF_LOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); - logData = rf_SearchAndDequeueParityLogData(raidPtr, regionID, - &raidPtr->parityLogDiskQueue.reintBlockHead, - &raidPtr->parityLogDiskQueue.reintBlockTail, + logData = rf_SearchAndDequeueParityLogData(raidPtr, regionID, + &raidPtr->parityLogDiskQueue.reintBlockHead, + &raidPtr->parityLogDiskQueue.reintBlockTail, RF_TRUE); logDataList = logData; while (logData) { logData->next = rf_SearchAndDequeueParityLogData( - raidPtr, regionID, - &raidPtr->parityLogDiskQueue.reintBlockHead, - &raidPtr->parityLogDiskQueue.reintBlockTail, + raidPtr, regionID, + &raidPtr->parityLogDiskQueue.reintBlockHead, + &raidPtr->parityLogDiskQueue.reintBlockTail, RF_TRUE); logData = logData->next; } @@ -556,7 +556,7 @@ ReintegrateLogs( rf_ReleaseParityLogs(raidPtr, freeLogList); } -int +int rf_ShutdownLogging(RF_Raid_t * raidPtr) { /* shutdown parity logging 1) disable parity logging in all regions 2) @@ -573,7 +573,7 @@ rf_ShutdownLogging(RF_Raid_t * raidPtr) if (rf_forceParityLogReint) { for (regionID = 0; regionID < rf_numParityRegions; regionID++) { RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); - raidPtr->regionInfo[regionID].loggingEnabled = + raidPtr->regionInfo[regionID].loggingEnabled = RF_FALSE; log = raidPtr->regionInfo[regionID].coreLog; raidPtr->regionInfo[regionID].coreLog = NULL; @@ -592,7 +592,7 @@ rf_ShutdownLogging(RF_Raid_t * raidPtr) return (0); } -int +int rf_ParityLoggingDiskManager(RF_Raid_t * raidPtr) { RF_ParityLog_t *reintQueue, *flushQueue; @@ -603,7 +603,7 @@ rf_ParityLoggingDiskManager(RF_Raid_t * raidPtr) * for work to appear in either the flush or reintegration queues and * is responsible for flushing core logs to the log disk as well as * reintegrating parity regions. - * + * * BLOCKING */ s = splbio(); @@ -631,7 +631,7 @@ rf_ParityLoggingDiskManager(RF_Raid_t * raidPtr) * buffers Second, reintegrate all regions which are * reported as full. Third, append queued log data * until blocked. - * + * * Note: Incoming appends (ParityLogAppend) can block on * either 1. empty buffer pool 2. region under * reintegration To preserve a global FIFO ordering of @@ -671,7 +671,7 @@ rf_ParityLoggingDiskManager(RF_Raid_t * raidPtr) /* thread enabled, no work needed, so sleep */ if (rf_parityLogDebug) printf("[parity logging disk manager sleeping]\n"); - RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, + RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, raidPtr->parityLogDiskQueue.mutex); if (rf_parityLogDebug) printf("[parity logging disk manager just woke up]\n"); diff --git a/sys/dev/raidframe/rf_paritylogging.c b/sys/dev/raidframe/rf_paritylogging.c index 4652e26bf00..98ce06f009d 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.22 2004/02/29 04:03:50 oster Exp $ */ +/* $NetBSD: rf_paritylogging.c,v 1.23 2005/02/27 00:27:45 perry 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.22 2004/02/29 04:03:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.23 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -70,7 +70,7 @@ static void rf_ShutdownParityLoggingRegionBufferPool(RF_ThreadArg_t arg); static void rf_ShutdownParityLoggingParityBufferPool(RF_ThreadArg_t arg); static void rf_ShutdownParityLoggingDiskQueue(RF_ThreadArg_t arg); -int +int rf_ConfigureParityLogging( RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, @@ -97,8 +97,8 @@ rf_ConfigureParityLogging( raidPtr->numSectorsPerLog = RF_DEFAULT_NUM_SECTORS_PER_LOG; /* create a parity logging configuration structure */ - RF_MallocAndAdd(info, sizeof(RF_ParityLoggingConfigInfo_t), - (RF_ParityLoggingConfigInfo_t *), + RF_MallocAndAdd(info, sizeof(RF_ParityLoggingConfigInfo_t), + (RF_ParityLoggingConfigInfo_t *), raidPtr->cleanupList); if (info == NULL) return (ENOMEM); @@ -106,8 +106,8 @@ rf_ConfigureParityLogging( /* 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), + info->stripeIdentifier = rf_make_2d_array((raidPtr->numCol), + (raidPtr->numCol), raidPtr->cleanupList); if (info->stripeIdentifier == NULL) return (ENOMEM); @@ -115,7 +115,7 @@ rf_ConfigureParityLogging( startdisk = 0; for (i = 0; i < (raidPtr->numCol); i++) { for (j = 0; j < (raidPtr->numCol); j++) { - info->stripeIdentifier[i][j] = (startdisk + j) % + info->stripeIdentifier[i][j] = (startdisk + j) % (raidPtr->numCol - 1); } if ((--startdisk) < 0) @@ -126,37 +126,37 @@ rf_ConfigureParityLogging( layoutPtr->numStripe = layoutPtr->stripeUnitsPerDisk; layoutPtr->numParityCol = 1; layoutPtr->numParityLogCol = 1; - layoutPtr->numDataCol = raidPtr->numCol - layoutPtr->numParityCol - + layoutPtr->numDataCol = raidPtr->numCol - layoutPtr->numParityCol - layoutPtr->numParityLogCol; - layoutPtr->dataSectorsPerStripe = layoutPtr->numDataCol * + layoutPtr->dataSectorsPerStripe = layoutPtr->numDataCol * layoutPtr->sectorsPerStripeUnit; layoutPtr->dataStripeUnitsPerDisk = layoutPtr->stripeUnitsPerDisk; - raidPtr->sectorsPerDisk = layoutPtr->stripeUnitsPerDisk * + raidPtr->sectorsPerDisk = layoutPtr->stripeUnitsPerDisk * layoutPtr->sectorsPerStripeUnit; - raidPtr->totalSectors = layoutPtr->stripeUnitsPerDisk * + raidPtr->totalSectors = layoutPtr->stripeUnitsPerDisk * layoutPtr->numDataCol * layoutPtr->sectorsPerStripeUnit; /* configure parity log parameters - * - * parameter comment/constraints - * ------------------------------------------- - * numParityRegions* all regions (except possibly last) - * of equal size - * totalInCoreLogCapacity* amount of memory in bytes available - * for in-core logs (default 1 MB) - * numSectorsPerLog# capacity of an in-core log in sectors + * + * parameter comment/constraints + * ------------------------------------------- + * numParityRegions* all regions (except possibly last) + * of equal size + * totalInCoreLogCapacity* amount of memory in bytes available + * for in-core logs (default 1 MB) + * numSectorsPerLog# capacity of an in-core log in sectors * (1 * disk track) * numParityLogs total number of in-core logs, - * should be at least numParityRegions - * regionLogCapacity size of a region log (except possibly - * last one) in sectors + * should be at least numParityRegions + * regionLogCapacity size of a region log (except possibly + * last one) in sectors * totalLogCapacity total amount of log space in sectors - * - * where '*' denotes a user settable parameter. - * Note that logs are fixed to be the size of a disk track, + * + * where '*' denotes a user settable parameter. + * Note that logs are fixed to be the size of a disk track, * value #defined in rf_paritylog.h - * + * */ totalLogCapacity = layoutPtr->stripeUnitsPerDisk * layoutPtr->sectorsPerStripeUnit * layoutPtr->numParityLogCol; @@ -170,29 +170,29 @@ rf_ConfigureParityLogging( fragmentation = raidPtr->regionLogCapacity % raidPtr->numSectorsPerLog; if (fragmentation > 0) for (i = 1; i < (raidPtr->numSectorsPerLog / 2); i++) { - if (((totalLogCapacity / (rf_numParityRegions + i)) % + if (((totalLogCapacity / (rf_numParityRegions + i)) % raidPtr->numSectorsPerLog) < fragmentation) { rf_numParityRegions++; raidPtr->regionLogCapacity = totalLogCapacity / rf_numParityRegions; - fragmentation = raidPtr->regionLogCapacity % + fragmentation = raidPtr->regionLogCapacity % raidPtr->numSectorsPerLog; } - if (((totalLogCapacity / (rf_numParityRegions - i)) % + if (((totalLogCapacity / (rf_numParityRegions - i)) % raidPtr->numSectorsPerLog) < fragmentation) { rf_numParityRegions--; raidPtr->regionLogCapacity = totalLogCapacity / rf_numParityRegions; - fragmentation = raidPtr->regionLogCapacity % + fragmentation = raidPtr->regionLogCapacity % raidPtr->numSectorsPerLog; } } /* ensure integral number of regions per log */ - raidPtr->regionLogCapacity = (raidPtr->regionLogCapacity / - raidPtr->numSectorsPerLog) * + raidPtr->regionLogCapacity = (raidPtr->regionLogCapacity / + raidPtr->numSectorsPerLog) * raidPtr->numSectorsPerLog; - raidPtr->numParityLogs = rf_totalInCoreLogCapacity / + raidPtr->numParityLogs = rf_totalInCoreLogCapacity / (raidPtr->bytesPerSector * raidPtr->numSectorsPerLog); /* to avoid deadlock, must ensure that enough logs exist for each * region to have one simultaneously */ @@ -202,20 +202,20 @@ rf_ConfigureParityLogging( /* create region information structs */ printf("Allocating %d bytes for in-core parity region info\n", (int) (rf_numParityRegions * sizeof(RF_RegionInfo_t))); - RF_Malloc(raidPtr->regionInfo, - (rf_numParityRegions * sizeof(RF_RegionInfo_t)), + RF_Malloc(raidPtr->regionInfo, + (rf_numParityRegions * sizeof(RF_RegionInfo_t)), (RF_RegionInfo_t *)); if (raidPtr->regionInfo == NULL) return (ENOMEM); /* last region may not be full capacity */ lastRegionCapacity = raidPtr->regionLogCapacity; - while ((rf_numParityRegions - 1) * raidPtr->regionLogCapacity + + while ((rf_numParityRegions - 1) * raidPtr->regionLogCapacity + lastRegionCapacity > totalLogCapacity) - lastRegionCapacity = lastRegionCapacity - + lastRegionCapacity = lastRegionCapacity - raidPtr->numSectorsPerLog; - raidPtr->regionParityRange = raidPtr->sectorsPerDisk / + raidPtr->regionParityRange = raidPtr->sectorsPerDisk / rf_numParityRegions; maxRegionParityRange = raidPtr->regionParityRange; @@ -225,11 +225,11 @@ rf_ConfigureParityLogging( /* build pool of unused parity logs */ printf("Allocating %d bytes for %d parity logs\n", - raidPtr->numParityLogs * raidPtr->numSectorsPerLog * + raidPtr->numParityLogs * raidPtr->numSectorsPerLog * raidPtr->bytesPerSector, raidPtr->numParityLogs); - RF_Malloc(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * - raidPtr->numSectorsPerLog * raidPtr->bytesPerSector, + RF_Malloc(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * + raidPtr->numSectorsPerLog * raidPtr->bytesPerSector, (caddr_t)); if (raidPtr->parityLogBufferHeap == NULL) return (ENOMEM); @@ -237,7 +237,7 @@ rf_ConfigureParityLogging( rc = rf_mutex_init(&raidPtr->parityLogPool.mutex); if (rc) { rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc); - RF_Free(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * + RF_Free(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * raidPtr->numSectorsPerLog * raidPtr->bytesPerSector); return (ENOMEM); } @@ -246,22 +246,22 @@ rf_ConfigureParityLogging( RF_Malloc(raidPtr->parityLogPool.parityLogs, sizeof(RF_ParityLog_t), (RF_ParityLog_t *)); if (raidPtr->parityLogPool.parityLogs == NULL) { - RF_Free(raidPtr->parityLogBufferHeap, - raidPtr->numParityLogs * - raidPtr->numSectorsPerLog * + RF_Free(raidPtr->parityLogBufferHeap, + raidPtr->numParityLogs * + raidPtr->numSectorsPerLog * raidPtr->bytesPerSector); return (ENOMEM); } l = raidPtr->parityLogPool.parityLogs; } else { - RF_Malloc(l->next, sizeof(RF_ParityLog_t), + RF_Malloc(l->next, sizeof(RF_ParityLog_t), (RF_ParityLog_t *)); if (l->next == NULL) { - RF_Free(raidPtr->parityLogBufferHeap, - raidPtr->numParityLogs * - raidPtr->numSectorsPerLog * + RF_Free(raidPtr->parityLogBufferHeap, + raidPtr->numParityLogs * + raidPtr->numSectorsPerLog * raidPtr->bytesPerSector); - for (l = raidPtr->parityLogPool.parityLogs; + for (l = raidPtr->parityLogPool.parityLogs; l; l = next) { next = l->next; @@ -274,23 +274,23 @@ rf_ConfigureParityLogging( l = l->next; } l->bufPtr = lHeapPtr; - lHeapPtr += raidPtr->numSectorsPerLog * + lHeapPtr += raidPtr->numSectorsPerLog * raidPtr->bytesPerSector; - RF_Malloc(l->records, (raidPtr->numSectorsPerLog * - sizeof(RF_ParityLogRecord_t)), + RF_Malloc(l->records, (raidPtr->numSectorsPerLog * + sizeof(RF_ParityLogRecord_t)), (RF_ParityLogRecord_t *)); if (l->records == NULL) { - RF_Free(raidPtr->parityLogBufferHeap, - raidPtr->numParityLogs * - raidPtr->numSectorsPerLog * + RF_Free(raidPtr->parityLogBufferHeap, + raidPtr->numParityLogs * + raidPtr->numSectorsPerLog * raidPtr->bytesPerSector); - for (l = raidPtr->parityLogPool.parityLogs; - l; + for (l = raidPtr->parityLogPool.parityLogs; + l; l = next) { next = l->next; if (l->records) - RF_Free(l->records, - (raidPtr->numSectorsPerLog * + RF_Free(l->records, + (raidPtr->numSectorsPerLog * sizeof(RF_ParityLogRecord_t))); RF_Free(l, sizeof(RF_ParityLog_t)); } @@ -305,49 +305,49 @@ rf_ConfigureParityLogging( return (ENOMEM); } raidPtr->regionBufferPool.cond = 0; - raidPtr->regionBufferPool.bufferSize = raidPtr->regionLogCapacity * + raidPtr->regionBufferPool.bufferSize = raidPtr->regionLogCapacity * raidPtr->bytesPerSector; - printf("regionBufferPool.bufferSize %d\n", + printf("regionBufferPool.bufferSize %d\n", raidPtr->regionBufferPool.bufferSize); /* for now, only one region at a time may be reintegrated */ - raidPtr->regionBufferPool.totalBuffers = 1; + raidPtr->regionBufferPool.totalBuffers = 1; - raidPtr->regionBufferPool.availableBuffers = + raidPtr->regionBufferPool.availableBuffers = raidPtr->regionBufferPool.totalBuffers; raidPtr->regionBufferPool.availBuffersIndex = 0; raidPtr->regionBufferPool.emptyBuffersIndex = 0; printf("Allocating %d bytes for regionBufferPool\n", - (int) (raidPtr->regionBufferPool.totalBuffers * + (int) (raidPtr->regionBufferPool.totalBuffers * sizeof(caddr_t))); - RF_Malloc(raidPtr->regionBufferPool.buffers, - raidPtr->regionBufferPool.totalBuffers * sizeof(caddr_t), + RF_Malloc(raidPtr->regionBufferPool.buffers, + raidPtr->regionBufferPool.totalBuffers * sizeof(caddr_t), (caddr_t *)); if (raidPtr->regionBufferPool.buffers == NULL) { return (ENOMEM); } for (i = 0; i < raidPtr->regionBufferPool.totalBuffers; i++) { printf("Allocating %d bytes for regionBufferPool#%d\n", - (int) (raidPtr->regionBufferPool.bufferSize * + (int) (raidPtr->regionBufferPool.bufferSize * sizeof(char)), i); - RF_Malloc(raidPtr->regionBufferPool.buffers[i], + RF_Malloc(raidPtr->regionBufferPool.buffers[i], raidPtr->regionBufferPool.bufferSize * sizeof(char), (caddr_t)); if (raidPtr->regionBufferPool.buffers[i] == NULL) { for (j = 0; j < i; j++) { - RF_Free(raidPtr->regionBufferPool.buffers[i], + RF_Free(raidPtr->regionBufferPool.buffers[i], raidPtr->regionBufferPool.bufferSize * sizeof(char)); } - RF_Free(raidPtr->regionBufferPool.buffers, - raidPtr->regionBufferPool.totalBuffers * + RF_Free(raidPtr->regionBufferPool.buffers, + raidPtr->regionBufferPool.totalBuffers * sizeof(caddr_t)); return (ENOMEM); } printf("raidPtr->regionBufferPool.buffers[%d] = %lx\n", i, (long) raidPtr->regionBufferPool.buffers[i]); } - rf_ShutdownCreate(listp, + rf_ShutdownCreate(listp, rf_ShutdownParityLoggingRegionBufferPool, raidPtr); /* build pool of parity buffers */ @@ -358,51 +358,51 @@ rf_ConfigureParityLogging( return (rc); } raidPtr->parityBufferPool.cond = 0; - raidPtr->parityBufferPool.bufferSize = parityBufferCapacity * + raidPtr->parityBufferPool.bufferSize = parityBufferCapacity * raidPtr->bytesPerSector; - printf("parityBufferPool.bufferSize %d\n", + printf("parityBufferPool.bufferSize %d\n", raidPtr->parityBufferPool.bufferSize); /* for now, only one region at a time may be reintegrated */ - raidPtr->parityBufferPool.totalBuffers = 1; + raidPtr->parityBufferPool.totalBuffers = 1; - raidPtr->parityBufferPool.availableBuffers = + raidPtr->parityBufferPool.availableBuffers = raidPtr->parityBufferPool.totalBuffers; raidPtr->parityBufferPool.availBuffersIndex = 0; raidPtr->parityBufferPool.emptyBuffersIndex = 0; printf("Allocating %d bytes for parityBufferPool of %d units\n", - (int) (raidPtr->parityBufferPool.totalBuffers * + (int) (raidPtr->parityBufferPool.totalBuffers * sizeof(caddr_t)), raidPtr->parityBufferPool.totalBuffers ); - RF_Malloc(raidPtr->parityBufferPool.buffers, - raidPtr->parityBufferPool.totalBuffers * sizeof(caddr_t), + RF_Malloc(raidPtr->parityBufferPool.buffers, + raidPtr->parityBufferPool.totalBuffers * sizeof(caddr_t), (caddr_t *)); if (raidPtr->parityBufferPool.buffers == NULL) { return (ENOMEM); } for (i = 0; i < raidPtr->parityBufferPool.totalBuffers; i++) { printf("Allocating %d bytes for parityBufferPool#%d\n", - (int) (raidPtr->parityBufferPool.bufferSize * + (int) (raidPtr->parityBufferPool.bufferSize * sizeof(char)),i); - RF_Malloc(raidPtr->parityBufferPool.buffers[i], + RF_Malloc(raidPtr->parityBufferPool.buffers[i], raidPtr->parityBufferPool.bufferSize * sizeof(char), (caddr_t)); if (raidPtr->parityBufferPool.buffers == NULL) { for (j = 0; j < i; j++) { - RF_Free(raidPtr->parityBufferPool.buffers[i], - raidPtr->regionBufferPool.bufferSize * + RF_Free(raidPtr->parityBufferPool.buffers[i], + raidPtr->regionBufferPool.bufferSize * sizeof(char)); } - RF_Free(raidPtr->parityBufferPool.buffers, - raidPtr->regionBufferPool.totalBuffers * + RF_Free(raidPtr->parityBufferPool.buffers, + raidPtr->regionBufferPool.totalBuffers * sizeof(caddr_t)); return (ENOMEM); } printf("parityBufferPool.buffers[%d] = %lx\n", i, (long) raidPtr->parityBufferPool.buffers[i]); } - rf_ShutdownCreate(listp, - rf_ShutdownParityLoggingParityBufferPool, + rf_ShutdownCreate(listp, + rf_ShutdownParityLoggingParityBufferPool, raidPtr); /* initialize parityLogDiskQueue */ rf_mutex_init(&raidPtr->parityLogDiskQueue.mutex); @@ -420,8 +420,8 @@ rf_ConfigureParityLogging( raidPtr->parityLogDiskQueue.freeDataList = NULL; raidPtr->parityLogDiskQueue.freeCommonList = NULL; - rf_ShutdownCreate(listp, - rf_ShutdownParityLoggingDiskQueue, + rf_ShutdownCreate(listp, + rf_ShutdownParityLoggingDiskQueue, raidPtr); for (i = 0; i < rf_numParityRegions; i++) { rc = rf_mutex_init(&raidPtr->regionInfo[i].mutex); @@ -429,8 +429,8 @@ rf_ConfigureParityLogging( rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc); for (j = 0; j < i; j++) FreeRegionInfo(raidPtr, j); - RF_Free(raidPtr->regionInfo, - (rf_numParityRegions * + RF_Free(raidPtr->regionInfo, + (rf_numParityRegions * sizeof(RF_RegionInfo_t))); return (ENOMEM); } @@ -439,51 +439,51 @@ rf_ConfigureParityLogging( rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc); for (j = 0; j < i; j++) FreeRegionInfo(raidPtr, j); - RF_Free(raidPtr->regionInfo, - (rf_numParityRegions * + RF_Free(raidPtr->regionInfo, + (rf_numParityRegions * sizeof(RF_RegionInfo_t))); return (ENOMEM); } raidPtr->regionInfo[i].reintInProgress = RF_FALSE; - raidPtr->regionInfo[i].regionStartAddr = + raidPtr->regionInfo[i].regionStartAddr = raidPtr->regionLogCapacity * i; - raidPtr->regionInfo[i].parityStartAddr = + raidPtr->regionInfo[i].parityStartAddr = raidPtr->regionParityRange * i; if (i < rf_numParityRegions - 1) { - raidPtr->regionInfo[i].capacity = + raidPtr->regionInfo[i].capacity = raidPtr->regionLogCapacity; - raidPtr->regionInfo[i].numSectorsParity = + raidPtr->regionInfo[i].numSectorsParity = raidPtr->regionParityRange; } else { - raidPtr->regionInfo[i].capacity = + raidPtr->regionInfo[i].capacity = lastRegionCapacity; - raidPtr->regionInfo[i].numSectorsParity = - raidPtr->sectorsPerDisk - + raidPtr->regionInfo[i].numSectorsParity = + raidPtr->sectorsPerDisk - raidPtr->regionParityRange * i; - if (raidPtr->regionInfo[i].numSectorsParity > + if (raidPtr->regionInfo[i].numSectorsParity > maxRegionParityRange) - maxRegionParityRange = + maxRegionParityRange = raidPtr->regionInfo[i].numSectorsParity; } raidPtr->regionInfo[i].diskCount = 0; - RF_ASSERT(raidPtr->regionInfo[i].capacity + - raidPtr->regionInfo[i].regionStartAddr <= + RF_ASSERT(raidPtr->regionInfo[i].capacity + + raidPtr->regionInfo[i].regionStartAddr <= totalLogCapacity); - RF_ASSERT(raidPtr->regionInfo[i].parityStartAddr + - raidPtr->regionInfo[i].numSectorsParity <= + RF_ASSERT(raidPtr->regionInfo[i].parityStartAddr + + raidPtr->regionInfo[i].numSectorsParity <= raidPtr->sectorsPerDisk); printf("Allocating %d bytes for region %d\n", (int) (raidPtr->regionInfo[i].capacity * sizeof(RF_DiskMap_t)), i); - RF_Malloc(raidPtr->regionInfo[i].diskMap, + RF_Malloc(raidPtr->regionInfo[i].diskMap, (raidPtr->regionInfo[i].capacity * - sizeof(RF_DiskMap_t)), + sizeof(RF_DiskMap_t)), (RF_DiskMap_t *)); if (raidPtr->regionInfo[i].diskMap == NULL) { for (j = 0; j < i; j++) FreeRegionInfo(raidPtr, j); - RF_Free(raidPtr->regionInfo, - (rf_numParityRegions * + RF_Free(raidPtr->regionInfo, + (rf_numParityRegions * sizeof(RF_RegionInfo_t))); return (ENOMEM); } @@ -491,11 +491,11 @@ rf_ConfigureParityLogging( raidPtr->regionInfo[i].coreLog = NULL; } rf_ShutdownCreate(listp, - rf_ShutdownParityLoggingRegionInfo, + rf_ShutdownParityLoggingRegionInfo, raidPtr); RF_ASSERT(raidPtr->parityLogDiskQueue.threadState == 0); raidPtr->parityLogDiskQueue.threadState = RF_PLOG_CREATED; - rc = RF_CREATE_THREAD(raidPtr->pLogDiskThreadHandle, + rc = RF_CREATE_THREAD(raidPtr->pLogDiskThreadHandle, rf_ParityLoggingDiskManager, raidPtr,"rf_log"); if (rc) { raidPtr->parityLogDiskQueue.threadState = 0; @@ -506,7 +506,7 @@ rf_ConfigureParityLogging( /* wait for thread to start */ RF_LOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); while (!(raidPtr->parityLogDiskQueue.threadState & RF_PLOG_RUNNING)) { - RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, + RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, raidPtr->parityLogDiskQueue.mutex); } RF_UNLOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); @@ -527,17 +527,17 @@ rf_ConfigureParityLogging( return (0); } -static void +static void FreeRegionInfo( RF_Raid_t * raidPtr, RF_RegionId_t regionID) { RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex); - RF_Free(raidPtr->regionInfo[regionID].diskMap, - (raidPtr->regionInfo[regionID].capacity * + RF_Free(raidPtr->regionInfo[regionID].diskMap, + (raidPtr->regionInfo[regionID].capacity * sizeof(RF_DiskMap_t))); if (!rf_forceParityLogReint && raidPtr->regionInfo[regionID].coreLog) { - rf_ReleaseParityLogs(raidPtr, + rf_ReleaseParityLogs(raidPtr, raidPtr->regionInfo[regionID].coreLog); raidPtr->regionInfo[regionID].coreLog = NULL; } else { @@ -548,7 +548,7 @@ FreeRegionInfo( } -static void +static void FreeParityLogQueue( RF_Raid_t * raidPtr, RF_ParityLogQueue_t * queue) @@ -560,7 +560,7 @@ FreeParityLogQueue( while (l1) { l2 = l1; l1 = l2->next; - RF_Free(l2->records, (raidPtr->numSectorsPerLog * + RF_Free(l2->records, (raidPtr->numSectorsPerLog * sizeof(RF_ParityLogRecord_t))); RF_Free(l2, sizeof(RF_ParityLog_t)); } @@ -568,7 +568,7 @@ FreeParityLogQueue( } -static void +static void FreeRegionBufferQueue(RF_RegionBufferQueue_t * queue) { int i; @@ -584,7 +584,7 @@ FreeRegionBufferQueue(RF_RegionBufferQueue_t * queue) RF_UNLOCK_MUTEX(queue->mutex); } -static void +static void rf_ShutdownParityLoggingRegionInfo(RF_ThreadArg_t arg) { RF_Raid_t *raidPtr; @@ -592,18 +592,18 @@ rf_ShutdownParityLoggingRegionInfo(RF_ThreadArg_t arg) raidPtr = (RF_Raid_t *) arg; if (rf_parityLogDebug) { - printf("raid%d: ShutdownParityLoggingRegionInfo\n", + printf("raid%d: ShutdownParityLoggingRegionInfo\n", raidPtr->raidid); } /* free region information structs */ for (i = 0; i < rf_numParityRegions; i++) FreeRegionInfo(raidPtr, i); - RF_Free(raidPtr->regionInfo, (rf_numParityRegions * + RF_Free(raidPtr->regionInfo, (rf_numParityRegions * sizeof(raidPtr->regionInfo))); raidPtr->regionInfo = NULL; } -static void +static void rf_ShutdownParityLoggingPool(RF_ThreadArg_t arg) { RF_Raid_t *raidPtr; @@ -614,24 +614,24 @@ rf_ShutdownParityLoggingPool(RF_ThreadArg_t arg) } /* free contents of parityLogPool */ FreeParityLogQueue(raidPtr, &raidPtr->parityLogPool); - RF_Free(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * + RF_Free(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs * raidPtr->numSectorsPerLog * raidPtr->bytesPerSector); } -static void +static void rf_ShutdownParityLoggingRegionBufferPool(RF_ThreadArg_t arg) { RF_Raid_t *raidPtr; raidPtr = (RF_Raid_t *) arg; if (rf_parityLogDebug) { - printf("raid%d: ShutdownParityLoggingRegionBufferPool\n", + printf("raid%d: ShutdownParityLoggingRegionBufferPool\n", raidPtr->raidid); } FreeRegionBufferQueue(&raidPtr->regionBufferPool); } -static void +static void rf_ShutdownParityLoggingParityBufferPool(RF_ThreadArg_t arg) { RF_Raid_t *raidPtr; @@ -644,7 +644,7 @@ rf_ShutdownParityLoggingParityBufferPool(RF_ThreadArg_t arg) FreeRegionBufferQueue(&raidPtr->parityBufferPool); } -static void +static void rf_ShutdownParityLoggingDiskQueue(RF_ThreadArg_t arg) { RF_ParityLogData_t *d; @@ -663,19 +663,19 @@ rf_ShutdownParityLoggingDiskQueue(RF_ThreadArg_t arg) RF_ASSERT(raidPtr->parityLogDiskQueue.reintTail == NULL); while (raidPtr->parityLogDiskQueue.freeDataList) { d = raidPtr->parityLogDiskQueue.freeDataList; - raidPtr->parityLogDiskQueue.freeDataList = + raidPtr->parityLogDiskQueue.freeDataList = raidPtr->parityLogDiskQueue.freeDataList->next; RF_Free(d, sizeof(RF_ParityLogData_t)); } while (raidPtr->parityLogDiskQueue.freeCommonList) { c = raidPtr->parityLogDiskQueue.freeCommonList; - raidPtr->parityLogDiskQueue.freeCommonList = + raidPtr->parityLogDiskQueue.freeCommonList = raidPtr->parityLogDiskQueue.freeCommonList->next; RF_Free(c, sizeof(RF_CommonLogData_t)); } } -static void +static void rf_ShutdownParityLogging(RF_ThreadArg_t arg) { RF_Raid_t *raidPtr; @@ -699,7 +699,7 @@ rf_ShutdownParityLogging(RF_ThreadArg_t arg) */ RF_LOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); while (!(raidPtr->parityLogDiskQueue.threadState & RF_PLOG_SHUTDOWN)) { - RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, + RF_WAIT_COND(raidPtr->parityLogDiskQueue.cond, raidPtr->parityLogDiskQueue.mutex); } RF_UNLOCK_MUTEX(raidPtr->parityLogDiskQueue.mutex); @@ -708,19 +708,19 @@ rf_ShutdownParityLogging(RF_ThreadArg_t arg) } } -int +int rf_GetDefaultNumFloatingReconBuffersParityLogging(RF_Raid_t * raidPtr) { return (20); } -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitParityLogging(RF_Raid_t * raidPtr) { return (10); } /* return the region ID for a given RAID address */ -RF_RegionId_t +RF_RegionId_t rf_MapRegionIDParityLogging( RF_Raid_t * raidPtr, RF_SectorNum_t address) @@ -734,7 +734,7 @@ rf_MapRegionIDParityLogging( regionID--; } RF_ASSERT(address >= raidPtr->regionInfo[regionID].parityStartAddr); - RF_ASSERT(address < raidPtr->regionInfo[regionID].parityStartAddr + + RF_ASSERT(address < raidPtr->regionInfo[regionID].parityStartAddr + raidPtr->regionInfo[regionID].numSectorsParity); RF_ASSERT(regionID < rf_numParityRegions); return (regionID); @@ -742,7 +742,7 @@ rf_MapRegionIDParityLogging( /* given a logical RAID sector, determine physical disk address of data */ -void +void rf_MapSectorParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -750,19 +750,19 @@ rf_MapSectorParityLogging( RF_SectorNum_t * diskSector, int remap) { - RF_StripeNum_t SUID = raidSector / + RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; /* *col = (SUID % (raidPtr->numCol - * raidPtr->Layout.numParityLogCol)); */ *col = SUID % raidPtr->Layout.numDataCol; - *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * + *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } /* given a logical RAID sector, determine physical disk address of parity */ -void +void rf_MapParityParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -770,21 +770,21 @@ rf_MapParityParityLogging( RF_SectorNum_t * diskSector, int remap) { - RF_StripeNum_t SUID = raidSector / + RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit; /* *col = * raidPtr->Layout.numDataCol-(SUID/raidPtr->Layout.numDataCol)%(raidPt * r->numCol - raidPtr->Layout.numParityLogCol); */ *col = raidPtr->Layout.numDataCol; - *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * + *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit + (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } /* given a regionID and sector offset, determine the physical disk address of the parity log */ -void +void rf_MapLogParityLogging( RF_Raid_t * raidPtr, RF_RegionId_t regionID, @@ -799,7 +799,7 @@ rf_MapLogParityLogging( /* given a regionID, determine the physical disk address of the logged parity for that region */ -void +void rf_MapRegionParity( RF_Raid_t * raidPtr, RF_RegionId_t regionID, @@ -815,21 +815,21 @@ rf_MapRegionParity( /* given a logical RAID address, determine the participating disks in the stripe */ -void +void rf_IdentifyStripeParityLogging( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids) { - RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, + RF_StripeNum_t stripeID = rf_RaidAddressToStripeID(&raidPtr->Layout, addr); - RF_ParityLoggingConfigInfo_t *info = (RF_ParityLoggingConfigInfo_t *) + RF_ParityLoggingConfigInfo_t *info = (RF_ParityLoggingConfigInfo_t *) raidPtr->Layout.layoutSpecificInfo; *diskids = info->stripeIdentifier[stripeID % raidPtr->numCol]; } -void +void rf_MapSIDToPSIDParityLogging( RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, @@ -845,7 +845,7 @@ rf_MapSIDToPSIDParityLogging( * one to a function that will return information about the DAG, and * another to a function that will create the dag. */ -void +void rf_ParityLoggingDagSelect( RF_Raid_t * raidPtr, RF_IoType_t type, @@ -880,8 +880,8 @@ rf_ParityLoggingDagSelect( if (prior_recon) { RF_RowCol_t oc = failedPDA->col; RF_SectorNum_t oo = failedPDA->startSector; - if (layoutPtr->map->flags & - RF_DISTRIBUTE_SPARE) { + if (layoutPtr->map->flags & + RF_DISTRIBUTE_SPARE) { /* redirect to dist spare space */ if (failedPDA == asmp->parityInfo) { @@ -912,7 +912,7 @@ rf_ParityLoggingDagSelect( } - } else { + } else { /* redirect to dedicated spare space */ failedPDA->col = raidPtr->Disks[fcol].spareCol; @@ -958,10 +958,10 @@ rf_ParityLoggingDagSelect( * when G is 3 or 4, numDataCol/2 is 1, and I want * single-stripe-unit updates to use just one disk. */ if ((asmp->numDataFailed + asmp->numParityFailed) == 0) { - if (((asmp->numStripeUnitsAccessed <= - (layoutPtr->numDataCol / 2)) && + if (((asmp->numStripeUnitsAccessed <= + (layoutPtr->numDataCol / 2)) && (layoutPtr->numDataCol != 1)) || - (asmp->parityInfo->next != NULL) || + (asmp->parityInfo->next != NULL) || rf_CheckStripeForFailures(raidPtr, asmp)) { *createFunc = (RF_VoidFuncPtr) rf_CreateParityLoggingSmallWriteDAG; } else diff --git a/sys/dev/raidframe/rf_paritylogging.h b/sys/dev/raidframe/rf_paritylogging.h index 6d19d8b260b..eaced38eb2f 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.4 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_paritylogging.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,38 +31,38 @@ #ifndef _RF__RF_PARITYLOGGING_H_ #define _RF__RF_PARITYLOGGING_H_ -int +int rf_ConfigureParityLogging(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersParityLogging(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitParityLogging(RF_Raid_t * raidPtr); -RF_RegionId_t +RF_RegionId_t rf_MapRegionIDParityLogging(RF_Raid_t * raidPtr, RF_SectorNum_t address); -void +void rf_MapSectorParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapLogParityLogging(RF_Raid_t * raidPtr, RF_RegionId_t regionID, RF_SectorNum_t regionOffset, RF_RowCol_t * col, RF_SectorNum_t * startSector); -void +void rf_MapRegionParity(RF_Raid_t * raidPtr, RF_RegionId_t regionID, RF_RowCol_t * col, RF_SectorNum_t * startSector, RF_SectorCount_t * numSector); -void +void rf_IdentifyStripeParityLogging(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDParityLogging(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_ParityLoggingDagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); diff --git a/sys/dev/raidframe/rf_parityloggingdags.c b/sys/dev/raidframe/rf_parityloggingdags.c index 7c51a87e322..8bbccffa43d 100644 --- a/sys/dev/raidframe/rf_parityloggingdags.c +++ b/sys/dev/raidframe/rf_parityloggingdags.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityloggingdags.c,v 1.13 2004/01/10 00:56:28 oster Exp $ */ +/* $NetBSD: rf_parityloggingdags.c,v 1.14 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.13 2004/01/10 00:56:28 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.14 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" #include "opt_raid_diagnostic.h" @@ -70,7 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.13 2004/01/10 00:56:28 os * *****************************************************************************/ -void +void rf_CommonCreateParityLoggingLargeWriteDAG( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, @@ -99,7 +99,7 @@ rf_CommonCreateParityLoggingLargeWriteDAG( /* alloc the Wnd nodes, the xor node, and the Lpo node */ nWndNodes = asmap->numStripeUnitsAccessed; - RF_MallocAndAdd(nodes, (nWndNodes + 6) * sizeof(RF_DagNode_t), + RF_MallocAndAdd(nodes, (nWndNodes + 6) * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList); i = 0; wndNodes = &nodes[i]; @@ -123,7 +123,7 @@ rf_CommonCreateParityLoggingLargeWriteDAG( rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, new_asm_h, &nRodNodes, &sosBuffer, &eosBuffer, allocList); if (nRodNodes > 0) - RF_MallocAndAdd(rodNodes, nRodNodes * sizeof(RF_DagNode_t), + RF_MallocAndAdd(rodNodes, nRodNodes * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList); /* begin node initialization */ @@ -183,7 +183,7 @@ rf_CommonCreateParityLoggingLargeWriteDAG( if (((RF_PhysDiskAddr_t *) rodNodes[i].params[0].p)->numSector == raidPtr->Layout.sectorsPerStripeUnit) break; if (i == nRodNodes) { - RF_MallocAndAdd(xorNode->results[0], + RF_MallocAndAdd(xorNode->results[0], rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit), (void *), allocList); } else { xorNode->results[0] = rodNodes[i].params[1].p; @@ -315,7 +315,7 @@ rf_CommonCreateParityLoggingLargeWriteDAG( * A null qfuncs indicates single fault tolerant *****************************************************************************/ -void +void rf_CommonCreateParityLoggingSmallWriteDAG( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, @@ -368,7 +368,7 @@ rf_CommonCreateParityLoggingSmallWriteDAG( dag_h->numSuccedents = 1; /* Step 2. create the nodes */ - RF_MallocAndAdd(nodes, totalNumNodes * sizeof(RF_DagNode_t), + RF_MallocAndAdd(nodes, totalNumNodes * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList); i = 0; blockNode = &nodes[i]; @@ -620,7 +620,7 @@ rf_CommonCreateParityLoggingSmallWriteDAG( } -void +void rf_CreateParityLoggingSmallWriteDAG( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, @@ -636,7 +636,7 @@ rf_CreateParityLoggingSmallWriteDAG( } -void +void rf_CreateParityLoggingLargeWriteDAG( RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, diff --git a/sys/dev/raidframe/rf_parityloggingdags.h b/sys/dev/raidframe/rf_parityloggingdags.h index 7d090af6593..2374c851a85 100644 --- a/sys/dev/raidframe/rf_parityloggingdags.h +++ b/sys/dev/raidframe/rf_parityloggingdags.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityloggingdags.h,v 1.3 1999/02/05 00:06:14 oster Exp $ */ +/* $NetBSD: rf_parityloggingdags.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,7 +36,7 @@ #define _RF__RF_PARITYLOGGINGDAGS_H_ /* routines that create DAGs */ -void +void rf_CommonCreateParityLoggingLargeWriteDAG(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h, void *bp, RF_RaidAccessFlags_t flags, RF_AllocListElem_t * allocList, diff --git a/sys/dev/raidframe/rf_parityscan.c b/sys/dev/raidframe/rf_parityscan.c index 4b689770c0f..f908aec434d 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.27 2004/03/18 17:26:36 oster Exp $ */ +/* $NetBSD: rf_parityscan.c,v 1.28 2005/02/27 00:27:45 perry 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.27 2004/03/18 17:26:36 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.28 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.27 2004/03/18 17:26:36 oster Exp * ****************************************************************************/ -int +int rf_RewriteParity(RF_Raid_t *raidPtr) { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -75,9 +75,9 @@ rf_RewriteParity(RF_Raid_t *raidPtr) } 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 - * "we can't" error. + * We're in degraded mode. Don't try to verify parity now! + * XXX: this should be a "we don't want to", not a + * "we can't" error. */ return (RF_PARITY_COULD_NOT_VERIFY); } @@ -86,18 +86,18 @@ rf_RewriteParity(RF_Raid_t *raidPtr) rc = RF_PARITY_OKAY; - for (i = 0; i < raidPtr->totalSectors && - rc <= RF_PARITY_CORRECTED; + for (i = 0; i < raidPtr->totalSectors && + rc <= RF_PARITY_CORRECTED; i += layoutPtr->dataSectorsPerStripe) { if (raidPtr->waitShutdown) { /* Someone is pulling the plug on this set... abort the re-write */ return (1); } - asm_h = rf_MapAccess(raidPtr, i, - layoutPtr->dataSectorsPerStripe, + asm_h = rf_MapAccess(raidPtr, i, + layoutPtr->dataSectorsPerStripe, NULL, RF_DONT_REMAP); - raidPtr->parity_rewrite_stripes_done = + raidPtr->parity_rewrite_stripes_done = i / layoutPtr->dataSectorsPerStripe ; rc = rf_VerifyParity(raidPtr, asm_h->stripeMap, 1, 0); @@ -134,7 +134,7 @@ rf_RewriteParity(RF_Raid_t *raidPtr) * region defined by the parityPDA. * ****************************************************************************/ -int +int rf_VerifyParity(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *aasm, int correct_it, RF_RaidAccessFlags_t flags) { @@ -153,10 +153,10 @@ rf_VerifyParity(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *aasm, rc = RF_PARITY_OKAY; if (lp->VerifyParity) { for (doasm = aasm; doasm; doasm = doasm->next) { - for (parityPDA = doasm->parityInfo; parityPDA; + for (parityPDA = doasm->parityInfo; parityPDA; parityPDA = parityPDA->next) { - lrc = lp->VerifyParity(raidPtr, - doasm->raidAddress, + lrc = lp->VerifyParity(raidPtr, + doasm->raidAddress, parityPDA, correct_it, flags); if (lrc > rc) { @@ -172,7 +172,7 @@ rf_VerifyParity(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *aasm, return (rc); } -int +int rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t *parityPDA, int correct_it, RF_RaidAccessFlags_t flags) @@ -192,8 +192,8 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, char *pbuf, *buf, *end_p, *p; int i, retcode; RF_ReconUnitNum_t which_ru; - RF_StripeNum_t psID = rf_RaidAddressToParityStripeID(layoutPtr, - raidAddr, + RF_StripeNum_t psID = rf_RaidAddressToParityStripeID(layoutPtr, + raidAddr, &which_ru); int stripeWidth = layoutPtr->numDataCol + layoutPtr->numParityCol; #if RF_ACC_TRACE > 0 @@ -320,7 +320,7 @@ out: return (retcode); } -int +int rf_TryToRedirectPDA(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda, int parity) { if (raidPtr->Disks[pda->col].status == rf_ds_reconstructing) { @@ -381,7 +381,7 @@ rf_TryToRedirectPDA(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda, int parity) * ****************************************************************************/ #if 0 -int +int rf_VerifyDegrModeWrite(RF_Raid_t *raidPtr, RF_AccessStripeMapHeader_t *asmh) { return (0); @@ -394,7 +394,7 @@ rf_VerifyDegrModeWrite(RF_Raid_t *raidPtr, RF_AccessStripeMapHeader_t *asmh) * second-level nodes, so they must be filled in later. * * commit point is established at unblock node - this means that any - * failure during dag execution causes the dag to fail + * failure during dag execution causes the dag to fail * * name - node names at the second level */ diff --git a/sys/dev/raidframe/rf_parityscan.h b/sys/dev/raidframe/rf_parityscan.h index 9df902a0427..04c84199e5a 100644 --- a/sys/dev/raidframe/rf_parityscan.h +++ b/sys/dev/raidframe/rf_parityscan.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityscan.h,v 1.4 2001/10/04 15:58:55 oster Exp $ */ +/* $NetBSD: rf_parityscan.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,10 +34,10 @@ #include "rf_alloclist.h" int rf_RewriteParity(RF_Raid_t * raidPtr); -int +int rf_VerifyParityBasic(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags); -int +int rf_VerifyParity(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * stripeMap, int correct_it, RF_RaidAccessFlags_t flags); int rf_TryToRedirectPDA(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, int parity); diff --git a/sys/dev/raidframe/rf_pq.c b/sys/dev/raidframe/rf_pq.c index 86ffb45ac4b..42dd3d81bad 100644 --- a/sys/dev/raidframe/rf_pq.c +++ b/sys/dev/raidframe/rf_pq.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_pq.c,v 1.13 2003/11/16 20:32:05 oster Exp $ */ +/* $NetBSD: rf_pq.c,v 1.14 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_pq.c,v 1.13 2003/11/16 20:32:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_pq.c,v 1.14 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_pq.c,v 1.13 2003/11/16 20:32:05 oster Exp $"); RF_RedFuncs_t rf_pFuncs = {rf_RegularONPFunc, "Regular Old-New P", rf_SimpleONPFunc, "Simple Old-New P"}; RF_RedFuncs_t rf_pRecoveryFuncs = {rf_RecoveryPFunc, "Recovery P Func", rf_RecoveryPFunc, "Recovery P Func"}; -int +int rf_RegularONPFunc(node) RF_DagNode_t *node; { @@ -66,21 +66,21 @@ rf_RegularONPFunc(node) same as simpleONQ func, but the coefficient is always 1 */ -int +int rf_SimpleONPFunc(node) RF_DagNode_t *node; { return (rf_SimpleXorFunc(node)); } -int +int rf_RecoveryPFunc(node) RF_DagNode_t *node; { return (rf_RecoveryXorFunc(node)); } -int +int rf_RegularPFunc(node) RF_DagNode_t *node; { @@ -89,10 +89,10 @@ rf_RegularPFunc(node) #endif /* (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) || (RF_INCLUDE_EVENODD > 0) */ #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) -static void +static void QDelta(char *dest, char *obuf, char *nbuf, unsigned length, unsigned char coeff); -static void +static void rf_InvertQ(unsigned long *qbuf, unsigned long *abuf, unsigned length, unsigned coeff); @@ -100,7 +100,7 @@ RF_RedFuncs_t rf_qFuncs = {rf_RegularONQFunc, "Regular Old-New Q", rf_SimpleONQF RF_RedFuncs_t rf_qRecoveryFuncs = {rf_RecoveryQFunc, "Recovery Q Func", rf_RecoveryQFunc, "Recovery Q Func"}; RF_RedFuncs_t rf_pqRecoveryFuncs = {rf_RecoveryPQFunc, "Recovery PQ Func", rf_RecoveryPQFunc, "Recovery PQ Func"}; -void +void rf_PQDagSelect( RF_Raid_t * raidPtr, RF_IoType_t type, @@ -221,7 +221,7 @@ rf_PQDagSelect( Used as a stop gap info function */ #if 0 -static void +static void PQOne(raidPtr, nSucc, nAnte, asmap) RF_Raid_t *raidPtr; int *nSucc; @@ -231,7 +231,7 @@ PQOne(raidPtr, nSucc, nAnte, asmap) *nSucc = *nAnte = 1; } -static void +static void PQOneTwo(raidPtr, nSucc, nAnte, asmap) RF_Raid_t *raidPtr; int *nSucc; @@ -249,7 +249,7 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQCreateLargeWriteDAG) rf_RegularPQFunc, RF_FALSE); } -int +int rf_RegularONQFunc(node) RF_DagNode_t *node; { @@ -314,7 +314,7 @@ rf_RegularONQFunc(node) raidPtr */ -int +int rf_SimpleONQFunc(node) RF_DagNode_t *node; { @@ -364,7 +364,7 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQCreateSmallWriteDAG) static void RegularQSubr(RF_DagNode_t *node, char *qbuf); -static void +static void RegularQSubr(node, qbuf) RF_DagNode_t *node; char *qbuf; @@ -408,7 +408,7 @@ RegularQSubr(node, qbuf) static void DegrQSubr(RF_DagNode_t *node); -static void +static void DegrQSubr(node) RF_DagNode_t *node; { @@ -470,7 +470,7 @@ DegrQSubr(node) corrupt the input for the q calculation. */ -int +int rf_RegularPQFunc(node) RF_DagNode_t *node; { @@ -478,7 +478,7 @@ rf_RegularPQFunc(node) return (rf_RegularXorFunc(node)); /* does the wakeup */ } -int +int rf_RegularQFunc(node) RF_DagNode_t *node; { @@ -507,7 +507,7 @@ rf_RegularQFunc(node) We treat this identically to the regularPQ case, ignoring the failedPDA extra argument. */ -void +void rf_Degraded_100_PQFunc(node) RF_DagNode_t *node; { @@ -550,7 +550,7 @@ rf_Degraded_100_PQFunc(node) * * */ -int +int rf_RecoveryQFunc(node) RF_DagNode_t *node; { @@ -590,7 +590,7 @@ rf_RecoveryQFunc(node) return (0); } -int +int rf_RecoveryPQFunc(node) RF_DagNode_t *node; { @@ -611,7 +611,7 @@ rf_RecoveryPQFunc(node) This is a "simple style" recovery func. */ -void +void rf_PQ_DegradedWriteQFunc(node) RF_DagNode_t *node; { @@ -669,7 +669,7 @@ rf_PQ_DegradedWriteQFunc(node) length in bytes; */ -void +void rf_IncQ(dest, buf, length, coeff) unsigned long *dest; unsigned long *buf; @@ -740,7 +740,7 @@ rf_IncQ(dest, buf, length, coeff) length in bytes. */ -static void +static void QDelta( char *dest, char *obuf, @@ -823,7 +823,7 @@ QDelta( * * Everything about this seems wrong. */ -void +void rf_PQ_recover(pbuf, qbuf, abuf, bbuf, length, coeff_a, coeff_b) unsigned long *pbuf; unsigned long *qbuf; @@ -888,7 +888,7 @@ rf_PQ_recover(pbuf, qbuf, abuf, bbuf, length, coeff_a, coeff_b) -static void +static void rf_InvertQ( unsigned long *qbuf, unsigned long *abuf, diff --git a/sys/dev/raidframe/rf_pq.h b/sys/dev/raidframe/rf_pq.h index 560950fabc6..3601b0f49f8 100644 --- a/sys/dev/raidframe/rf_pq.h +++ b/sys/dev/raidframe/rf_pq.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_pq.h,v 1.3 1999/02/05 00:06:15 oster Exp $ */ +/* $NetBSD: rf_pq.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * rf_pq.h */ @@ -48,7 +48,7 @@ extern RF_RedFuncs_t rf_qFuncs; extern RF_RedFuncs_t rf_qRecoveryFuncs; extern RF_RedFuncs_t rf_pqRecoveryFuncs; -void +void rf_PQDagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); RF_CREATE_DAG_FUNC_DECL(rf_PQCreateLargeWriteDAG); @@ -61,10 +61,10 @@ void rf_Degraded_100_PQFunc(RF_DagNode_t * node); int rf_RecoveryQFunc(RF_DagNode_t * node); int rf_RecoveryPQFunc(RF_DagNode_t * node); void rf_PQ_DegradedWriteQFunc(RF_DagNode_t * node); -void +void rf_IncQ(unsigned long *dest, unsigned long *buf, unsigned length, unsigned coeff); -void +void rf_PQ_recover(unsigned long *pbuf, unsigned long *qbuf, unsigned long *abuf, unsigned long *bbuf, unsigned length, unsigned coeff_a, unsigned coeff_b); diff --git a/sys/dev/raidframe/rf_pqdeg.c b/sys/dev/raidframe/rf_pqdeg.c index d71770219eb..c2ce030e396 100644 --- a/sys/dev/raidframe/rf_pqdeg.c +++ b/sys/dev/raidframe/rf_pqdeg.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_pqdeg.c,v 1.7 2001/11/13 07:11:16 lukem Exp $ */ +/* $NetBSD: rf_pqdeg.c,v 1.8 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_pqdeg.c,v 1.7 2001/11/13 07:11:16 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_pqdeg.c,v 1.8 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -122,12 +122,12 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_100_CreateWriteDAG); RF_CREATE_DAG_FUNC_DECL(rf_PQ_100_CreateWriteDAG) { if (asmap->numStripeUnitsAccessed != 1 && - asmap->failedPDAs[0]->numSector != + asmap->failedPDAs[0]->numSector != raidPtr->Layout.sectorsPerStripeUnit) RF_PANIC(); - rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, - flags, allocList, 2, - (int (*) (RF_DagNode_t *)) rf_Degraded_100_PQFunc, + rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, + flags, allocList, 2, + (int (*) (RF_DagNode_t *)) rf_Degraded_100_PQFunc, RF_FALSE); } /* Dead P - act like a RAID 5 small write with parity = Q */ @@ -138,13 +138,13 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateSmallWriteDAG) temp = asmap->parityInfo; asmap->parityInfo = asmap->qInfo; asmap->qInfo = temp; - rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_qFuncs, NULL); } /* Dead Q - act like a RAID 5 small write */ RF_CREATE_DAG_FUNC_DECL(rf_PQ_001_CreateSmallWriteDAG) { - rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateSmallWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, &rf_pFuncs, NULL); } /* Dead P - act like a RAID 5 large write but for Q */ @@ -155,13 +155,13 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_010_CreateLargeWriteDAG) temp = asmap->parityInfo; asmap->parityInfo = asmap->qInfo; asmap->qInfo = temp; - rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularQFunc, RF_FALSE); } /* Dead Q - act like a RAID 5 large write */ RF_CREATE_DAG_FUNC_DECL(rf_PQ_001_CreateLargeWriteDAG) { - rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, + rf_CommonCreateLargeWriteDAG(raidPtr, asmap, dag_h, bp, flags, allocList, 1, rf_RegularPFunc, RF_FALSE); } @@ -200,7 +200,7 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_110_CreateWriteDAG) asmap->parityInfo = asmap->qInfo; asmap->qInfo = temp; rf_CommonCreateSimpleDegradedWriteDAG(raidPtr, asmap, dag_h, bp, flags, - allocList, 1, + allocList, 1, (int (*) (RF_DagNode_t *)) rf_PQ_DegradedWriteQFunc, RF_FALSE); /* is the regular Q func the right one to call? */ diff --git a/sys/dev/raidframe/rf_pqdegdags.c b/sys/dev/raidframe/rf_pqdegdags.c index af94a6c4bc4..001798aa530 100644 --- a/sys/dev/raidframe/rf_pqdegdags.c +++ b/sys/dev/raidframe/rf_pqdegdags.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_pqdegdags.c,v 1.9 2004/01/10 00:56:28 oster Exp $ */ +/* $NetBSD: rf_pqdegdags.c,v 1.10 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_pqdegdags.c,v 1.9 2004/01/10 00:56:28 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_pqdegdags.c,v 1.10 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_pqdegdags.c,v 1.9 2004/01/10 00:56:28 oster Exp $ #include "rf_pqdegdags.h" #include "rf_pq.h" -static void +static void applyPDA(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, RF_PhysDiskAddr_t * ppda, RF_PhysDiskAddr_t * qpda, void *bp); @@ -120,7 +120,7 @@ RF_CREATE_DAG_FUNC_DECL(rf_PQ_DoubleDegRead) "Rq", "PQ Recovery", rf_PQDoubleRecoveryFunc); } -static void +static void applyPDA(raidPtr, pda, ppda, qpda, bp) RF_Raid_t *raidPtr; RF_PhysDiskAddr_t *pda; @@ -187,7 +187,7 @@ applyPDA(raidPtr, pda, ppda, qpda, bp) */ -int +int rf_PQDoubleRecoveryFunc(node) RF_DagNode_t *node; { @@ -276,29 +276,29 @@ rf_PQDoubleRecoveryFunc(node) return (0); } -int +int rf_PQWriteDoubleRecoveryFunc(node) RF_DagNode_t *node; { /* The situation: - * + * * We are doing a write that hits only one failed data unit. The other * failed data unit is not being overwritten, so we need to generate * it. - * + * * For the moment, we assume all the nonfailed data being written is in * the shadow of the failed data unit. (i.e,, either a single data * unit write or the entire failed stripe unit is being overwritten. ) - * + * * Recovery strategy: apply the recovery data to the parity and q. Use P * & Q to recover the second failed data unit in P. Zero fill Q, then * apply the recovered data to p. Then apply the data being written to * the failed drive. Then walk through the surviving drives, applying * new data when it exists, othewise the recovery data. Quite a mess. - * - * + * + * * The params - * + * * read pda0, read pda1, ... read pda (numDataCol-3), write pda0, ... , * write pda (numStripeUnitAccess - numDataFailed), failed pda, * raidPtr, asmap */ diff --git a/sys/dev/raidframe/rf_psstatus.c b/sys/dev/raidframe/rf_psstatus.c index 4b26edc99f7..9d6d57dd8f4 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.28 2004/03/18 16:54:54 oster Exp $ */ +/* $NetBSD: rf_psstatus.c,v 1.29 2005/02/27 00:27:45 perry 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.28 2004/03/18 16:54:54 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.29 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.28 2004/03/18 16:54:54 oster Exp $ #define Dprintf3(s,a,b,c) #endif -static void +static void RealPrintPSStatusTable(RF_Raid_t * raidPtr, RF_PSStatusHeader_t * pssTable); @@ -66,14 +66,14 @@ RealPrintPSStatusTable(RF_Raid_t * raidPtr, static void rf_ShutdownPSStatus(void *); -static void +static void rf_ShutdownPSStatus(void *arg) { pool_destroy(&rf_pools.pss); } -int +int rf_ConfigurePSStatus(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -95,8 +95,8 @@ rf_MakeParityStripeStatusTable(RF_Raid_t *raidPtr) { RF_PSStatusHeader_t *pssTable; int i; - - RF_Malloc(pssTable, + + RF_Malloc(pssTable, raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t), (RF_PSStatusHeader_t *)); for (i = 0; i < raidPtr->pssTableSize; i++) { @@ -105,8 +105,8 @@ rf_MakeParityStripeStatusTable(RF_Raid_t *raidPtr) return (pssTable); } -void -rf_FreeParityStripeStatusTable(RF_Raid_t *raidPtr, +void +rf_FreeParityStripeStatusTable(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable) { #if RF_DEBUG_PSS @@ -131,7 +131,7 @@ rf_FreeParityStripeStatusTable(RF_Raid_t *raidPtr, * otherwise returns NULL if the status structure does not exist * * ASSUMES THE PSS DESCRIPTOR IS LOCKED UPON ENTRY - * + * * flags - whether or not to use newpssPtr if the needed PSS * doesn't exist and what flags to set it to initially */ @@ -182,8 +182,8 @@ rf_LookupRUStatus(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable, * no recon was requested while recon was blocked. Assumes the hash * chain is ALREADY LOCKED. */ -void -rf_PSStatusDelete(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable, +void +rf_PSStatusDelete(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable, RF_ReconParityStripeStatus_t *pssPtr) { RF_PSStatusHeader_t *hdr = &(pssTable[RF_HASH_PSID(raidPtr, pssPtr->parityStripeID)]); @@ -205,8 +205,8 @@ rf_PSStatusDelete(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable, RF_ASSERT(0); /* we must find it here */ } /* deletes an entry from the ps status table after reconstruction has completed */ -void -rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, +void +rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, RF_ReconUnitNum_t which_ru) { RF_PSStatusHeader_t *hdr = &(raidPtr->reconControl->pssTable[RF_HASH_PSID(raidPtr, psid)]); @@ -218,7 +218,7 @@ rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, ltsleep(&hdr->lock, PRIBIO, "rf_racrecon", 0, &hdr->mutex); } hdr->lock = 1; - RF_UNLOCK_MUTEX(hdr->mutex); + RF_UNLOCK_MUTEX(hdr->mutex); for (pt = NULL, p = hdr->chain; p; pt = p, p = p->next) { if ((p->parityStripeID == psid) && (p->which_ru == which_ru)) break; @@ -236,7 +236,7 @@ rf_RemoveFromActiveReconTable(RF_Raid_t *raidPtr, RF_StripeNum_t psid, else hdr->chain = p->next; p->next = NULL; - + RF_LOCK_MUTEX(hdr->mutex); hdr->lock = 0; RF_UNLOCK_MUTEX(hdr->mutex); @@ -265,7 +265,7 @@ rf_AllocPSStatus(RF_Raid_t *raidPtr) return (p); } -void +void rf_FreePSStatus(RF_Raid_t *raidPtr, RF_ReconParityStripeStatus_t *p) { RF_ASSERT(p->procWaitList == NULL); @@ -275,7 +275,7 @@ rf_FreePSStatus(RF_Raid_t *raidPtr, RF_ReconParityStripeStatus_t *p) pool_put(&rf_pools.pss, p); } -static void +static void RealPrintPSStatusTable(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable) { int i, j, procsWaiting, blocksWaiting, bufsWaiting; @@ -315,7 +315,7 @@ RealPrintPSStatusTable(RF_Raid_t *raidPtr, RF_PSStatusHeader_t *pssTable) } } -void +void rf_PrintPSStatusTable(RF_Raid_t *raidPtr) { RF_PSStatusHeader_t *pssTable = raidPtr->reconControl->pssTable; diff --git a/sys/dev/raidframe/rf_psstatus.h b/sys/dev/raidframe/rf_psstatus.h index cada6ab1f06..428fdf6d4e1 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.10 2004/04/09 17:01:03 oster Exp $ */ +/* $NetBSD: rf_psstatus.h,v 1.11 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -125,9 +125,9 @@ struct RF_PSStatusHeader_s { int rf_ConfigurePSStatus(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *); RF_PSStatusHeader_t *rf_MakeParityStripeStatusTable(RF_Raid_t *); void rf_FreeParityStripeStatusTable(RF_Raid_t *, RF_PSStatusHeader_t *); -RF_ReconParityStripeStatus_t *rf_LookupRUStatus(RF_Raid_t *, RF_PSStatusHeader_t *, - RF_StripeNum_t, RF_ReconUnitNum_t, - RF_PSSFlags_t, +RF_ReconParityStripeStatus_t *rf_LookupRUStatus(RF_Raid_t *, RF_PSStatusHeader_t *, + RF_StripeNum_t, RF_ReconUnitNum_t, + RF_PSSFlags_t, RF_ReconParityStripeStatus_t *); void rf_PSStatusDelete(RF_Raid_t *, RF_PSStatusHeader_t *, RF_ReconParityStripeStatus_t *); diff --git a/sys/dev/raidframe/rf_raid.h b/sys/dev/raidframe/rf_raid.h index e2050bfb6ee..fa1fee6f4ad 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.33 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_raid.h,v 1.34 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -98,8 +98,8 @@ struct RF_ThroughputStats_s { struct RF_Raid_s { /* This portion never changes, and can be accessed without locking */ /* an exception is Disks[][].status, which requires locking when it is - * changed. XXX this is no longer true. numSpare and friends can - * change now. + * changed. XXX this is no longer true. numSpare and friends can + * change now. */ u_int numCol; /* number of columns of disks, typically == # * of disks/rank */ @@ -131,7 +131,7 @@ struct RF_Raid_s { RF_LockTableEntry_t *lockTable; /* stripe-lock table */ RF_LockTableEntry_t *quiesceLock; /* quiesnce table */ int numFailures; /* total number of failures in the array */ - int numNewFailures; /* number of *new* failures (that havn't + int numNewFailures; /* number of *new* failures (that havn't caused a mod_counter update */ int parity_good; /* !0 if parity is known to be correct */ @@ -140,19 +140,19 @@ struct RF_Raid_s { int clean; /* the clean bit for this array. */ int openings; /* Number of IO's which can be scheduled - simultaneously (high-level - not a + simultaneously (high-level - not a per-component limit)*/ int maxOutstanding; /* maxOutstanding requests (per-component) */ - int autoconfigure; /* automatically configure this RAID set. + int autoconfigure; /* automatically configure this RAID set. 0 == no, 1 == yes */ int root_partition; /* Use this set as / 0 == no, 1 == yes*/ - int last_unit; /* last unit number (e.g. 0 for /dev/raid0) + int last_unit; /* last unit number (e.g. 0 for /dev/raid0) of this component. Used for autoconfigure only. */ int config_order; /* 0 .. n. The order in which the component - should be auto-configured. E.g. 0 is will + should be auto-configured. E.g. 0 is will done first, (and would become raid0). This may be in conflict with last_unit!!?! */ /* Not currently used. */ @@ -160,7 +160,7 @@ struct RF_Raid_s { /* queue to gather up requests from KernelWakeupFunc() and let a kernel thread deal with calling rf_DiskIOComplete and any callback functions. */ - TAILQ_HEAD(iodone_q,RF_DiskQueueData_s) iodone; + TAILQ_HEAD(iodone_q,RF_DiskQueueData_s) iodone; /* and a lock to protect it */ struct simplelock iodone_lock; diff --git a/sys/dev/raidframe/rf_raid0.c b/sys/dev/raidframe/rf_raid0.c index 98468303d2f..2507cec624e 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.11 2004/08/27 15:55:51 oster Exp $ */ +/* $NetBSD: rf_raid0.c,v 1.12 2005/02/27 00:27:45 perry 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.11 2004/08/27 15:55:51 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid0.c,v 1.12 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -51,7 +51,7 @@ typedef struct RF_Raid0ConfigInfo_s { RF_RowCol_t *stripeIdentifier; } RF_Raid0ConfigInfo_t; -int +int rf_ConfigureRAID0(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -79,7 +79,7 @@ rf_ConfigureRAID0(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -void +void rf_MapSectorRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -89,7 +89,7 @@ rf_MapSectorRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_MapParityRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -97,7 +97,7 @@ rf_MapParityRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, *diskSector = 0; } -void +void rf_IdentifyStripeRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids) { @@ -107,7 +107,7 @@ rf_IdentifyStripeRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, *diskids = info->stripeIdentifier; } -void +void rf_MapSIDToPSIDRAID0(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru) { @@ -115,7 +115,7 @@ rf_MapSIDToPSIDRAID0(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, *psID = stripeID; } -void +void rf_RAID0DagSelect( RF_Raid_t * raidPtr, RF_IoType_t type, @@ -130,7 +130,7 @@ rf_RAID0DagSelect( (RF_VoidFuncPtr) rf_CreateFaultFreeReadDAG : (RF_VoidFuncPtr) rf_CreateRAID0WriteDAG); } -int +int rf_VerifyParityRAID0(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t *parityPDA, int correct_it, RF_RaidAccessFlags_t flags) diff --git a/sys/dev/raidframe/rf_raid0.h b/sys/dev/raidframe/rf_raid0.h index 4392a603f43..03d7e51c02a 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.4 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid0.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,26 +31,26 @@ #ifndef _RF__RF_RAID0_H_ #define _RF__RF_RAID0_H_ -int +int rf_ConfigureRAID0(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); -void +void rf_MapSectorRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDRAID0(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RAID0DagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); -int +int rf_VerifyParityRAID0(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags); diff --git a/sys/dev/raidframe/rf_raid1.c b/sys/dev/raidframe/rf_raid1.c index 2e63393c703..8eddfe6c0cb 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.24 2004/03/18 16:54:54 oster Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.25 2005/02/27 00:27:45 perry 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.24 2004/03/18 16:54:54 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.25 2005/02/27 00:27:45 perry Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -57,7 +57,7 @@ typedef struct RF_Raid1ConfigInfo_s { RF_RowCol_t **stripeIdentifier; } RF_Raid1ConfigInfo_t; /* start of day code specific to RAID level 1 */ -int +int rf_ConfigureRAID1(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -94,7 +94,7 @@ rf_ConfigureRAID1(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, /* returns the physical disk location of the primary copy in the mirror pair */ -void +void rf_MapSectorRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -111,7 +111,7 @@ rf_MapSectorRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, * returns the physical disk location of the secondary copy in the mirror * pair */ -void +void rf_MapParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -128,7 +128,7 @@ rf_MapParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, * * returns a list of disks for a given redundancy group */ -void +void rf_IdentifyStripeRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids) { @@ -145,7 +145,7 @@ rf_IdentifyStripeRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, * * maps a logical stripe to a stripe in the redundant array */ -void +void rf_MapSIDToPSIDRAID1(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru) { @@ -164,7 +164,7 @@ rf_MapSIDToPSIDRAID1(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, * createFunc - name of function to use to create the graph *****************************************************************************/ -void +void rf_RAID1DagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_AccessStripeMap_t *asmap, RF_VoidFuncPtr *createFunc) { @@ -179,7 +179,7 @@ rf_RAID1DagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, if (asmap->numDataFailed + asmap->numParityFailed > 1) { #if RF_DEBUG_DAG - if (rf_dagDebug) + if (rf_dagDebug) RF_ERRORMSG("Multiple disks failed in a single group! Aborting I/O operation.\n"); #endif *createFunc = NULL; @@ -226,8 +226,8 @@ rf_RAID1DagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, #if RF_DEBUG_DAG > 0 || RF_DEBUG_MAP > 0 if (rf_dagDebug || rf_mapDebug) { printf("raid%d: Redirected type '%c' c %d o %ld -> c %d o %ld\n", - raidPtr->raidid, type, oc, - (long) oo, + raidPtr->raidid, type, oc, + (long) oo, failedPDA->col, (long) failedPDA->startSector); } @@ -245,7 +245,7 @@ rf_RAID1DagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, } } -int +int rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t *parityPDA, int correct_it, RF_RaidAccessFlags_t flags) @@ -295,7 +295,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, #if RF_DEBUG_VERIFYPARITY if (rf_verifyParityDebug) { printf("raid%d: RAID1 parity verify: buf=%lx bcount=%d (%lx - %lx)\n", - raidPtr->raidid, (long) buf, bcount, (long) buf, + raidPtr->raidid, (long) buf, bcount, (long) buf, (long) buf + bcount); } #endif @@ -370,7 +370,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, #endif #if 0 if (rf_verifyParityDebug > 1) { - printf("raid%d: RAID1 parity verify read dag:\n", + printf("raid%d: RAID1 parity verify read dag:\n", raidPtr->raidid); rf_PrintDAGList(rd_dag_h); } @@ -416,7 +416,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, #if RF_DEBUG_VERIFYPARITY if (rf_verifyParityDebug) { printf("raid%d: RAID1 parity verify %d bytes: i=%d buf1=%lx buf2=%lx buf=%lx\n", - raidPtr->raidid, nbytes, i, (long) buf1, + raidPtr->raidid, nbytes, i, (long) buf1, (long) buf2, (long) buf); } #endif @@ -529,19 +529,19 @@ done: rf_FreeAllocList(allocList); #if RF_DEBUG_VERIFYPARITY if (rf_verifyParityDebug) { - printf("raid%d: RAID1 parity verify, returning %d\n", + printf("raid%d: RAID1 parity verify, returning %d\n", raidPtr->raidid, ret); } #endif return (ret); } -/* rbuf - the recon buffer to submit +/* rbuf - the recon buffer to submit * keep_it - whether we can keep this buffer or we have to return it * use_committed - whether to use a committed or an available recon buffer */ -int +int rf_SubmitReconBufferRAID1(RF_ReconBuffer_t *rbuf, int keep_it, int use_committed) { @@ -564,7 +564,7 @@ rf_SubmitReconBufferRAID1(RF_ReconBuffer_t *rbuf, int keep_it, #if RF_DEBUG_RECON if (rf_reconbufferDebug) { printf("raid%d: RAID1 reconbuffer submission c%d psid %ld ru%d (failed offset %ld)\n", - raidPtr->raidid, rbuf->col, + raidPtr->raidid, rbuf->col, (long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->failedDiskSectorOffset); } @@ -600,7 +600,7 @@ rf_SubmitReconBufferRAID1(RF_ReconBuffer_t *rbuf, int keep_it, if (keep_it) { #if RF_DEBUG_RECON if (rf_reconbufferDebug) { - printf("raid%d: RAID1 rbuf submission: keeping rbuf\n", + printf("raid%d: RAID1 rbuf submission: keeping rbuf\n", raidPtr->raidid); } #endif @@ -692,7 +692,7 @@ out: RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex); #if RF_DEBUG_RECON if (rf_reconbufferDebug) { - printf("raid%d: RAID1 rbuf submission: returning %d\n", + printf("raid%d: RAID1 rbuf submission: returning %d\n", raidPtr->raidid, retcode); } #endif diff --git a/sys/dev/raidframe/rf_raid1.h b/sys/dev/raidframe/rf_raid1.h index 4efa1c1e3ca..2d37845df39 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.5 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid1.h,v 1.6 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,29 +33,29 @@ #include <dev/raidframe/raidframevar.h> -int +int rf_ConfigureRAID1(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); -void +void rf_MapSectorRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDRAID1(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RAID1DagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); -int +int rf_VerifyParityRAID1(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr, RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags); -int +int rf_SubmitReconBufferRAID1(RF_ReconBuffer_t * rbuf, int keep_int, int use_committed); diff --git a/sys/dev/raidframe/rf_raid4.c b/sys/dev/raidframe/rf_raid4.c index ec1b6b27d4c..19119219e82 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.8 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_raid4.c,v 1.9 2005/02/27 00:27:45 perry 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.8 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid4.c,v 1.9 2005/02/27 00:27:45 perry Exp $"); #include "rf_raid.h" #include "rf_dag.h" @@ -53,7 +53,7 @@ typedef struct RF_Raid4ConfigInfo_s { -int +int rf_ConfigureRAID4(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -84,19 +84,19 @@ rf_ConfigureRAID4(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -int +int rf_GetDefaultNumFloatingReconBuffersRAID4(RF_Raid_t *raidPtr) { return (20); } -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID4(RF_Raid_t *raidPtr) { return (20); } -void +void rf_MapSectorRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -106,7 +106,7 @@ rf_MapSectorRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_MapParityRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -117,7 +117,7 @@ rf_MapParityRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_IdentifyStripeRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids) { @@ -126,7 +126,7 @@ rf_IdentifyStripeRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, *diskids = info->stripeIdentifier; } -void +void rf_MapSIDToPSIDRAID4(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru) { diff --git a/sys/dev/raidframe/rf_raid4.h b/sys/dev/raidframe/rf_raid4.h index 6de2689589a..6d6632efddf 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.4 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid4.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,25 +31,25 @@ #ifndef _RF__RF_RAID4_H_ #define _RF__RF_RAID4_H_ -int +int rf_ConfigureRAID4(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersRAID4(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID4(RF_Raid_t * raidPtr); -void +void rf_MapSectorRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeRAID4(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDRAID4(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RAID4DagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); diff --git a/sys/dev/raidframe/rf_raid5.c b/sys/dev/raidframe/rf_raid5.c index b20a81840a0..01e3705cb78 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.14 2004/03/05 03:58:21 oster Exp $ */ +/* $NetBSD: rf_raid5.c,v 1.15 2005/02/27 00:27:45 perry 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.14 2004/03/05 03:58:21 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid5.c,v 1.15 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -54,7 +54,7 @@ typedef struct RF_Raid5ConfigInfo_s { * by IdentifyStripe */ } RF_Raid5ConfigInfo_t; -int +int rf_ConfigureRAID5(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -94,27 +94,27 @@ rf_ConfigureRAID5(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, return (0); } -int +int rf_GetDefaultNumFloatingReconBuffersRAID5(RF_Raid_t *raidPtr) { return (20); } -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID5(RF_Raid_t *raidPtr) { return (10); } #if !defined(__NetBSD__) && !defined(_KERNEL) /* not currently used */ -int +int rf_ShutdownRAID5(RF_Raid_t *raidPtr) { return (0); } #endif -void +void rf_MapSectorRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -124,7 +124,7 @@ rf_MapSectorRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_MapParityRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap) { @@ -135,7 +135,7 @@ rf_MapParityRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_IdentifyStripeRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, RF_RowCol_t **diskids) { @@ -145,7 +145,7 @@ rf_IdentifyStripeRAID5(RF_Raid_t *raidPtr, RF_RaidAddr_t addr, *diskids = info->stripeIdentifier[stripeID % raidPtr->numCol]; } -void +void rf_MapSIDToPSIDRAID5(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru) { @@ -156,7 +156,7 @@ rf_MapSIDToPSIDRAID5(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID, * one to a function that will return information about the DAG, and * another to a function that will create the dag. */ -void +void rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_AccessStripeMap_t *asmap, RF_VoidFuncPtr *createFunc) @@ -172,7 +172,7 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, if ((asmap->numDataFailed + asmap->numParityFailed > 1) || (raidPtr->numFailures > 1)){ #if RF_DEBUG_DAG - if (rf_dagDebug) + if (rf_dagDebug) RF_ERRORMSG("Multiple disks failed in a single group! Aborting I/O operation.\n"); #endif *createFunc = NULL; @@ -180,7 +180,7 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, } if (asmap->numDataFailed + asmap->numParityFailed == 1) { - + /* if under recon & already reconstructed, redirect * the access to the spare drive and eliminate the * failure indication */ @@ -195,17 +195,17 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, #if RF_DEBUG_DAG > 0 || RF_DEBUG_MAP > 0 RF_RowCol_t oc = failedPDA->col; RF_SectorNum_t oo = failedPDA->startSector; -#endif +#endif #if RF_INCLUDE_PARITY_DECLUSTERING_DS > 0 if (layoutPtr->map->flags & RF_DISTRIBUTE_SPARE) { /* redirect to dist * spare space */ - + if (failedPDA == asmap->parityInfo) { - + /* parity has failed */ (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; @@ -221,19 +221,19 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_ASSERT(0); /* should not ever * happen */ } else { - + /* data has failed */ (layoutPtr->map->MapSector) (raidPtr, failedPDA->raidAddress, &failedPDA->col, &failedPDA->startSector, RF_REMAP); - + } - + } else { -#endif +#endif /* redirect to dedicated spare space */ - + failedPDA->col = raidPtr->Disks[fcol].spareCol; - + /* the parity may have two distinct * components, both of which may need * to be redirected */ @@ -250,11 +250,11 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, } #endif RF_ASSERT(failedPDA->col != -1); - + #if RF_DEBUG_DAG > 0 || RF_DEBUG_MAP > 0 if (rf_dagDebug || rf_mapDebug) { printf("raid%d: Redirected type '%c' c %d o %ld -> c %d o %ld\n", - raidPtr->raidid, type, oc, + raidPtr->raidid, type, oc, (long) oo, failedPDA->col, (long) failedPDA->startSector); } diff --git a/sys/dev/raidframe/rf_raid5.h b/sys/dev/raidframe/rf_raid5.h index b855abe4867..46bbc08df26 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.4 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid5.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,25 +31,25 @@ #ifndef _RF__RF_RAID5_H_ #define _RF__RF_RAID5_H_ -int +int rf_ConfigureRAID5(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); int rf_GetDefaultNumFloatingReconBuffersRAID5(RF_Raid_t * raidPtr); RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitRAID5(RF_Raid_t * raidPtr); -void +void rf_MapSectorRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeRAID5(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDRAID5(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); -void +void rf_RaidFiveDagSelect(RF_Raid_t * raidPtr, RF_IoType_t type, RF_AccessStripeMap_t * asmap, RF_VoidFuncPtr * createFunc); diff --git a/sys/dev/raidframe/rf_raid5_rotatedspare.c b/sys/dev/raidframe/rf_raid5_rotatedspare.c index 9994af67381..822346247c8 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.8 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid5_rotatedspare.c,v 1.9 2005/02/27 00:27:45 perry 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.8 2003/12/29 02:38:18 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid5_rotatedspare.c,v 1.9 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" @@ -53,7 +53,7 @@ typedef struct RF_Raid5RSConfigInfo_s { * IdentifyStripe */ } RF_Raid5RSConfigInfo_t; -int +int rf_ConfigureRAID5_RS( RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, @@ -98,14 +98,14 @@ rf_ConfigureRAID5_RS( return (0); } -RF_ReconUnitCount_t +RF_ReconUnitCount_t rf_GetNumSpareRUsRAID5_RS(raidPtr) RF_Raid_t *raidPtr; { return (raidPtr->Layout.stripeUnitsPerDisk / raidPtr->numCol); } -void +void rf_MapSectorRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -127,7 +127,7 @@ rf_MapSectorRAID5_RS( (raidSector % raidPtr->Layout.sectorsPerStripeUnit); } -void +void rf_MapParityRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, @@ -144,7 +144,7 @@ rf_MapParityRAID5_RS( *col = (*col + 1) % raidPtr->numCol; } -void +void rf_IdentifyStripeRAID5_RS( RF_Raid_t * raidPtr, RF_RaidAddr_t addr, @@ -156,7 +156,7 @@ rf_IdentifyStripeRAID5_RS( } -void +void rf_MapSIDToPSIDRAID5_RS( RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, diff --git a/sys/dev/raidframe/rf_raid5_rotatedspare.h b/sys/dev/raidframe/rf_raid5_rotatedspare.h index 6f59e482b68..a8b3dd6cd02 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.4 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_raid5_rotatedspare.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,20 +31,20 @@ #ifndef _RF__RF_RAID5_ROTATEDSPARE_H_ #define _RF__RF_RAID5_ROTATEDSPARE_H_ -int +int rf_ConfigureRAID5_RS(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr, RF_Config_t * cfgPtr); RF_ReconUnitCount_t rf_GetNumSpareRUsRAID5_RS(RF_Raid_t * raidPtr); -void +void rf_MapSectorRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_MapParityRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t * col, RF_SectorNum_t * diskSector, int remap); -void +void rf_IdentifyStripeRAID5_RS(RF_Raid_t * raidPtr, RF_RaidAddr_t addr, RF_RowCol_t ** diskids); -void +void rf_MapSIDToPSIDRAID5_RS(RF_RaidLayout_t * layoutPtr, RF_StripeNum_t stripeID, RF_StripeNum_t * psID, RF_ReconUnitNum_t * which_ru); diff --git a/sys/dev/raidframe/rf_reconbuffer.c b/sys/dev/raidframe/rf_reconbuffer.c index 79539eb5c0f..fdf534bbafd 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.21 2004/03/18 16:54:54 oster Exp $ */ +/* $NetBSD: rf_reconbuffer.c,v 1.22 2005/02/27 00:27:45 perry 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.21 2004/03/18 16:54:54 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.22 2005/02/27 00:27:45 perry Exp $"); #include "rf_raid.h" #include "rf_reconbuffer.h" @@ -72,7 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.21 2004/03/18 16:54:54 oster Ex * * Returns non-zero if and only if we were not able to submit. * In this case, we append the current disk ID to the wait list on the - * indicated RU, so that it will be re-enabled when we acquire a buffer + * indicated RU, so that it will be re-enabled when we acquire a buffer * for this RU. * ****************************************************************************/ @@ -99,7 +99,7 @@ static const RF_VoidFuncPtr nWayXorFuncs[] = { * keep_it - whether we can keep this buffer or we have to return it * use_committed - whether to use a committed or an available recon buffer */ -int +int rf_SubmitReconBuffer(RF_ReconBuffer_t *rbuf, int keep_it, int use_committed) { const RF_LayoutSW_t *lp; @@ -115,8 +115,8 @@ rf_SubmitReconBuffer(RF_ReconBuffer_t *rbuf, int keep_it, int use_committed) * keep_it - whether we can keep this buffer or we have to return it * use_committed - whether to use a committed or an available recon buffer */ -int -rf_SubmitReconBufferBasic(RF_ReconBuffer_t *rbuf, int keep_it, +int +rf_SubmitReconBufferBasic(RF_ReconBuffer_t *rbuf, int keep_it, int use_committed) { RF_Raid_t *raidPtr = rbuf->raidPtr; @@ -293,7 +293,7 @@ out: return (retcode); } /* pssPtr - the pss descriptor for this parity stripe */ -int +int rf_MultiWayReconXor(RF_Raid_t *raidPtr, RF_ReconParityStripeStatus_t *pssPtr) { int i, numBufs = pssPtr->xorBufCount; @@ -362,8 +362,8 @@ rf_GetFullReconBuffer(RF_ReconCtrl_t *reconCtrlPtr) * which is maintained sorted by failed disk sector offset * * ASSUMES THE RB_MUTEX IS LOCKED AT ENTRY. */ -int -rf_CheckForFullRbuf(RF_Raid_t *raidPtr, RF_ReconCtrl_t *reconCtrl, +int +rf_CheckForFullRbuf(RF_Raid_t *raidPtr, RF_ReconCtrl_t *reconCtrl, RF_ReconParityStripeStatus_t *pssPtr, int numDataCol) { RF_ReconBuffer_t *p, *pt, *rbuf = (RF_ReconBuffer_t *) pssPtr->rbuf; @@ -395,7 +395,7 @@ rf_CheckForFullRbuf(RF_Raid_t *raidPtr, RF_ReconCtrl_t *reconCtrl, /* release a floating recon buffer for someone else to use. * assumes the rb_mutex is LOCKED at entry */ -void +void rf_ReleaseFloatingReconBuffer(RF_Raid_t *raidPtr, RF_ReconBuffer_t *rbuf) { RF_ReconCtrl_t *rcPtr = raidPtr->reconControl; diff --git a/sys/dev/raidframe/rf_reconbuffer.h b/sys/dev/raidframe/rf_reconbuffer.h index fce1bc32274..f7b48f2be34 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.6 2003/12/29 02:38:18 oster Exp $ */ +/* $NetBSD: rf_reconbuffer.h,v 1.7 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -39,20 +39,20 @@ #include "rf_reconstruct.h" -int +int rf_SubmitReconBuffer(RF_ReconBuffer_t * rbuf, int keep_int, int use_committed); -int +int rf_SubmitReconBufferBasic(RF_ReconBuffer_t * rbuf, int keep_int, int use_committed); -int +int rf_MultiWayReconXor(RF_Raid_t * raidPtr, RF_ReconParityStripeStatus_t * pssPtr); RF_ReconBuffer_t *rf_GetFullReconBuffer(RF_ReconCtrl_t * reconCtrlPtr); -int +int rf_CheckForFullRbuf(RF_Raid_t * raidPtr, RF_ReconCtrl_t * reconCtrl, RF_ReconParityStripeStatus_t * pssPtr, int numDataCol); -void +void 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 386a450d1e4..b68bc6b7ece 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.25 2004/03/18 17:46:22 oster Exp $ */ +/* $NetBSD: rf_reconmap.c,v 1.26 2005/02/27 00:27:45 perry 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.25 2004/03/18 17:46:22 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.26 2005/02/27 00:27:45 perry Exp $"); #include "rf_raid.h" #include <sys/time.h> @@ -54,21 +54,21 @@ __KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.25 2004/03/18 17:46:22 oster Exp $ /* For most reconstructs we need at most 3 RF_ReconMapListElem_t's. * Bounding the number we need is quite difficult, as it depends on how * badly the sectors to be reconstructed get divided up. In the current - * code, the reconstructed sectors appeared aligned on stripe boundaries, - * and are always presented in stripe width units, so we're probably + * code, the reconstructed sectors appeared aligned on stripe boundaries, + * and are always presented in stripe width units, so we're probably * allocating quite a bit more than we'll ever need. */ #define RF_NUM_RECON_POOL_ELEM 100 -static void +static void compact_stat_entry(RF_Raid_t * raidPtr, RF_ReconMap_t * mapPtr, int i); -static void crunch_list(RF_ReconMap_t *mapPtr, +static void crunch_list(RF_ReconMap_t *mapPtr, RF_ReconMapListElem_t * listPtr); static RF_ReconMapListElem_t * MakeReconMapListElem(RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector, RF_SectorNum_t stopSector, RF_ReconMapListElem_t * next); -static void +static void FreeReconMapListElem(RF_ReconMap_t *mapPtr, RF_ReconMapListElem_t * p); #if 0 static void PrintList(RF_ReconMapListElem_t * listPtr); @@ -84,7 +84,7 @@ static void PrintList(RF_ReconMapListElem_t * listPtr); *-------------------------------------------------------------------------*/ RF_ReconMap_t * -rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors, +rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors, RF_SectorCount_t disk_sectors, RF_ReconUnitCount_t spareUnitsPerDisk) { @@ -106,7 +106,7 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors, (void) memset((char *) p->status, 0, num_rus * sizeof(RF_ReconMapListElem_t *)); - + pool_init(&p->elem_pool, sizeof(RF_ReconMapListElem_t), 0, 0, 0, "raidreconpl", NULL); pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM); @@ -133,7 +133,7 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors, * stuff. *-------------------------------------------------------------------------*/ -void +void rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector, RF_SectorNum_t stopSector) { @@ -147,7 +147,7 @@ rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, } mapPtr->lock = 1; RF_UNLOCK_MUTEX(mapPtr->mutex); - RF_ASSERT(startSector >= 0 && stopSector < mapPtr->sectorsInDisk && + RF_ASSERT(startSector >= 0 && stopSector < mapPtr->sectorsInDisk && stopSector >= startSector); while (startSector <= stopSector) { @@ -199,7 +199,7 @@ rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, * *-------------------------------------------------------------------------*/ -static void +static void compact_stat_entry(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, int i) { RF_SectorCount_t sectorsPerReconUnit = mapPtr->sectorsPerReconUnit; @@ -208,7 +208,7 @@ compact_stat_entry(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, int i) crunch_list(mapPtr, p); if ((p->startSector == i * sectorsPerReconUnit) && - (p->stopSector == i * sectorsPerReconUnit + + (p->stopSector == i * sectorsPerReconUnit + sectorsPerReconUnit - 1)) { mapPtr->status[i] = RU_ALL; mapPtr->unitsLeft--; @@ -216,7 +216,7 @@ compact_stat_entry(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, int i) } } -static void +static void crunch_list(RF_ReconMap_t *mapPtr, RF_ReconMapListElem_t *listPtr) { RF_ReconMapListElem_t *pt, *p = listPtr; @@ -261,7 +261,7 @@ MakeReconMapListElem(RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector, * *-------------------------------------------------------------------------*/ -static void +static void FreeReconMapListElem(RF_ReconMap_t *mapPtr, RF_ReconMapListElem_t *p) { pool_put(&mapPtr->elem_pool, p); @@ -272,7 +272,7 @@ FreeReconMapListElem(RF_ReconMap_t *mapPtr, RF_ReconMapListElem_t *p) * any time. * *-------------------------------------------------------------------------*/ -void +void rf_FreeReconMap(RF_ReconMap_t *mapPtr) { RF_ReconMapListElem_t *p, *q; @@ -292,7 +292,7 @@ rf_FreeReconMap(RF_ReconMap_t *mapPtr) } } pool_destroy(&mapPtr->elem_pool); - RF_Free(mapPtr->status, mapPtr->totalRUs * + RF_Free(mapPtr->status, mapPtr->totalRUs * sizeof(RF_ReconMapListElem_t *)); RF_Free(mapPtr, sizeof(RF_ReconMap_t)); } @@ -302,7 +302,7 @@ rf_FreeReconMap(RF_ReconMap_t *mapPtr) * *-------------------------------------------------------------------------*/ -int +int rf_CheckRUReconstructed(RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector) { RF_ReconMapListElem_t *l; /* used for searching */ @@ -313,7 +313,7 @@ rf_CheckRUReconstructed(RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector) return ((l == RU_ALL) ? 1 : 0); } -RF_ReconUnitCount_t +RF_ReconUnitCount_t rf_UnitsLeftToReconstruct(RF_ReconMap_t *mapPtr) { RF_ASSERT(mapPtr != NULL); @@ -321,18 +321,18 @@ rf_UnitsLeftToReconstruct(RF_ReconMap_t *mapPtr) } #if 0 -static void +static void PrintList(RF_ReconMapListElem_t *listPtr) { while (listPtr) { - printf("%d,%d -> ", (int) listPtr->startSector, + printf("%d,%d -> ", (int) listPtr->startSector, (int) listPtr->stopSector); listPtr = listPtr->next; } printf("\n"); } -void +void rf_PrintReconMap(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, RF_RowCol_t fcol) { RF_ReconUnitCount_t numRUs; @@ -359,19 +359,19 @@ rf_PrintReconMap(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr, RF_RowCol_t fcol) #endif #if RF_DEBUG_RECON -void +void rf_PrintReconSchedule(RF_ReconMap_t *mapPtr, struct timeval *starttime) { static int old_pctg = -1; struct timeval tv, diff; int new_pctg; - new_pctg = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * + new_pctg = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs); if (new_pctg != old_pctg) { RF_GETTIME(tv); RF_TIMEVAL_DIFF(starttime, &tv, &diff); - printf("%d %d.%06d\n", (int) new_pctg, (int) diff.tv_sec, + printf("%d %d.%06d\n", (int) new_pctg, (int) diff.tv_sec, (int) diff.tv_usec); old_pctg = new_pctg; } diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index 722c6d5ad96..016f509e4f7 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.86 2005/02/12 03:44:41 oster Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.87 2005/02/27 00:27:45 perry 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.86 2005/02/12 03:44:41 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.87 2005/02/27 00:27:45 perry Exp $"); #include <sys/time.h> #include <sys/buf.h> @@ -108,7 +108,7 @@ static void FreeReconDesc(RF_RaidReconDesc_t *); static int ProcessReconEvent(RF_Raid_t *, RF_ReconEvent_t *); static int IssueNextReadRequest(RF_Raid_t *, RF_RowCol_t); static int TryToRead(RF_Raid_t *, RF_RowCol_t); -static int ComputePSDiskOffsets(RF_Raid_t *, RF_StripeNum_t, RF_RowCol_t, +static int ComputePSDiskOffsets(RF_Raid_t *, RF_StripeNum_t, RF_RowCol_t, RF_SectorNum_t *, RF_SectorNum_t *, RF_RowCol_t *, RF_SectorNum_t *); static int IssueNextWriteRequest(RF_Raid_t *); @@ -141,13 +141,13 @@ struct RF_ReconDoneProc_s { * in the kernel, we fire off the recon thread. * **************************************************************************/ -static void +static void rf_ShutdownReconstruction(void *ignored) { pool_destroy(&rf_pools.reconbuffer); } -int +int rf_ConfigureReconstruction(RF_ShutdownList_t **listp) { @@ -159,7 +159,7 @@ rf_ConfigureReconstruction(RF_ShutdownList_t **listp) } static RF_RaidReconDesc_t * -AllocRaidReconDesc(RF_Raid_t *raidPtr, RF_RowCol_t col, +AllocRaidReconDesc(RF_Raid_t *raidPtr, RF_RowCol_t col, RF_RaidDisk_t *spareDiskPtr, int numDisksDone, RF_RowCol_t scol) { @@ -178,13 +178,13 @@ AllocRaidReconDesc(RF_Raid_t *raidPtr, RF_RowCol_t col, return (reconDesc); } -static void +static void FreeReconDesc(RF_RaidReconDesc_t *reconDesc) { #if RF_RECON_STATS > 0 printf("raid%d: %lu recon event waits, %lu recon delays\n", reconDesc->raidPtr->raidid, - (long) reconDesc->numReconEventWaits, + (long) reconDesc->numReconEventWaits, (long) reconDesc->numReconExecDelays); #endif /* RF_RECON_STATS > 0 */ printf("raid%d: %lu max exec ticks\n", @@ -203,7 +203,7 @@ FreeReconDesc(RF_RaidReconDesc_t *reconDesc) * within its own thread. It won't return until reconstruction completes, * fails, or is aborted. *****************************************************************************/ -int +int rf_ReconstructFailedDisk(RF_Raid_t *raidPtr, RF_RowCol_t col) { const RF_LayoutSW_t *lp; @@ -234,7 +234,7 @@ rf_ReconstructFailedDisk(RF_Raid_t *raidPtr, RF_RowCol_t col) return (rc); } -int +int rf_ReconstructFailedDiskBasic(RF_Raid_t *raidPtr, RF_RowCol_t col) { RF_ComponentLabel_t c_label; @@ -296,7 +296,7 @@ rf_ReconstructFailedDiskBasic(RF_Raid_t *raidPtr, RF_RowCol_t col) raidPtr->raid_cinfo[scol].ci_dev, raidPtr->raid_cinfo[scol].ci_vp, &c_label); - + raid_init_component_label( raidPtr, &c_label); c_label.row = 0; c_label.column = col; @@ -315,7 +315,7 @@ rf_ReconstructFailedDiskBasic(RF_Raid_t *raidPtr, RF_RowCol_t col) RF_UNLOCK_MUTEX(raidPtr->mutex); /* XXXX MORE NEEDED HERE */ - + raidwrite_component_label( raidPtr->raid_cinfo[scol].ci_dev, raidPtr->raid_cinfo[scol].ci_vp, @@ -337,11 +337,11 @@ rf_ReconstructFailedDiskBasic(RF_Raid_t *raidPtr, RF_RowCol_t col) return (rc); } -/* +/* Allow reconstructing a disk in-place -- i.e. component /dev/sd2e goes AWOL, - and you don't get a spare until the next Monday. With this function - (and hot-swappable drives) you can now put your new disk containing + and you don't get a spare until the next Monday. With this function + (and hot-swappable drives) you can now put your new disk containing /dev/sd2e on the bus, scsictl it alive, and then use raidctl(8) to rebuild the data "on the spot". @@ -387,37 +387,37 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) RF_NORMAL_COMPONENT_UPDATE); RF_LOCK_MUTEX(raidPtr->mutex); } - + while (raidPtr->reconInProgress) { RF_WAIT_COND(raidPtr->waitForReconCond, raidPtr->mutex); } - + raidPtr->reconInProgress++; - + /* first look for a spare drive onto which to reconstruct the data. spare disk descriptors are stored in row 0. This may have to change eventually */ - + /* 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[col].status == rf_ds_failed); */ - + #if RF_INCLUDE_PARITY_DECLUSTERING_DS > 0 if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) { 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); RF_SIGNAL_COND(raidPtr->waitForReconCond); return (EINVAL); - } + } #endif proc = raidPtr->engine_thread; - - /* This device may have been opened successfully the + + /* This device may have been opened successfully the first time. Close it before trying to open it again.. */ - + if (raidPtr->raid_cinfo[col].ci_vp != NULL) { #if 0 printf("Closed the open device: %s\n", @@ -432,19 +432,19 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) } /* note that this disk was *not* auto_configured (any longer)*/ raidPtr->Disks[col].auto_configured = 0; - + #if 0 printf("About to (re-)open the device for rebuilding: %s\n", raidPtr->Disks[col].devname); #endif RF_UNLOCK_MUTEX(raidPtr->mutex); 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[col].devname, retcode); - - /* the component isn't responding properly... + + /* the component isn't responding properly... must be still dead :-( */ RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->reconInProgress--; @@ -453,9 +453,9 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) return(retcode); } - /* Ok, so we can at least do a lookup... + /* Ok, so we can at least do a lookup... How about actually getting a vp for it? */ - + if ((retcode = VOP_GETATTR(vp, &va, proc->p_ucred, proc)) != 0) { RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->reconInProgress--; @@ -474,29 +474,29 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) } RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->Disks[col].blockSize = dpart.disklab->d_secsize; - + raidPtr->Disks[col].numBlocks = dpart.part->p_size - rf_protectedSectors; - + raidPtr->raid_cinfo[col].ci_vp = vp; raidPtr->raid_cinfo[col].ci_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[col].numBlocks = raidPtr->Disks[col].numBlocks * rf_sizePercentage / 100; RF_UNLOCK_MUTEX(raidPtr->mutex); - + spareDiskPtr = &raidPtr->Disks[col]; spareDiskPtr->status = rf_ds_used_spare; - - printf("raid%d: initiating in-place reconstruction on column %d\n", + + printf("raid%d: initiating in-place reconstruction on column %d\n", raidPtr->raidid, col); - reconDesc = AllocRaidReconDesc((void *) raidPtr, col, spareDiskPtr, + reconDesc = AllocRaidReconDesc((void *) raidPtr, col, spareDiskPtr, numDisksDone, col); raidPtr->reconDesc = (void *) reconDesc; #if RF_RECON_STATS > 0 @@ -508,16 +508,16 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) reconDesc->reconExecTicks = 0; reconDesc->maxReconExecTicks = 0; rc = rf_ContinueReconstructFailedDisk(reconDesc); - + if (!rc) { RF_LOCK_MUTEX(raidPtr->mutex); /* 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[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[col].ci_dev, @@ -538,7 +538,7 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) raidPtr->parity_good = RF_RAID_CLEAN; RF_UNLOCK_MUTEX(raidPtr->mutex); - + raidwrite_component_label(raidPtr->raid_cinfo[col].ci_dev, raidPtr->raid_cinfo[col].ci_vp, &c_label); @@ -556,13 +556,13 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col) RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->reconInProgress--; RF_UNLOCK_MUTEX(raidPtr->mutex); - + RF_SIGNAL_COND(raidPtr->waitForReconCond); return (rc); } -int +int rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) { RF_Raid_t *raidPtr = reconDesc->raidPtr; @@ -583,20 +583,20 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) /* create one trace record per physical disk */ RF_Malloc(raidPtr->recon_tracerecs, raidPtr->numCol * sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *)); #endif - + /* quiesce the array prior to starting recon. this is needed * to assure no nasty interactions with pending user writes. * We need to do this before we change the disk or row status. */ - + Dprintf("RECON: begin request suspend\n"); rf_SuspendNewRequestsAndWait(raidPtr); Dprintf("RECON: end request suspend\n"); - + /* allocate our RF_ReconCTRL_t before we protect raidPtr->reconControl[row] */ 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 = tmp_reconctrl; @@ -604,14 +604,14 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) 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->starttime); - + /* now start up the actual reconstruction: issue a read for * each surviving disk */ - + reconDesc->numDisksDone = 0; for (i = 0; i < raidPtr->numCol; i++) { if (i != col) { @@ -626,7 +626,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) Dprintf("RECON: resume requests\n"); rf_ResumeNewRequests(raidPtr); - + /* process reconstruction events until all disks report that * they've completed all work */ @@ -635,7 +635,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) write_error = 0; while (reconDesc->numDisksDone < raidPtr->numCol - 1) { - + event = rf_GetNextReconEvent(reconDesc); status = ProcessReconEvent(raidPtr, event); @@ -644,13 +644,13 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) reconDesc->numDisksDone++; } else if ((status == RF_RECON_READ_ERROR) || (status == RF_RECON_WRITE_ERROR)) { - /* an error was encountered while reconstructing... - Pretend we've finished this disk. + /* an error was encountered while reconstructing... + Pretend we've finished this disk. */ recon_error = 1; raidPtr->reconControl->error = 1; - /* bump the numDisksDone count for reads, + /* bump the numDisksDone count for reads, but not for writes */ if (status == RF_RECON_READ_ERROR) reconDesc->numDisksDone++; @@ -682,21 +682,21 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) } } - raidPtr->reconControl->numRUsTotal = + raidPtr->reconControl->numRUsTotal = mapPtr->totalRUs; - raidPtr->reconControl->numRUsComplete = - mapPtr->totalRUs - + raidPtr->reconControl->numRUsComplete = + mapPtr->totalRUs - rf_UnitsLeftToReconstruct(mapPtr); #if RF_DEBUG_RECON - raidPtr->reconControl->percentComplete = + raidPtr->reconControl->percentComplete = (raidPtr->reconControl->numRUsComplete * 100 / raidPtr->reconControl->numRUsTotal); if (rf_prReconSched) { rf_PrintReconSchedule(raidPtr->reconControl->reconMap, &(raidPtr->reconControl->starttime)); } #endif } - + mapPtr = raidPtr->reconControl->reconMap; if (rf_reconDebug) { printf("RECON: all reads completed\n"); @@ -705,13 +705,13 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) * for any pending writes to complete, and then we're done */ while (!recon_error && rf_UnitsLeftToReconstruct(raidPtr->reconControl->reconMap) > 0) { - + event = rf_GetNextReconEvent(reconDesc); status = ProcessReconEvent(raidPtr, event); if (status == RF_RECON_WRITE_ERROR) { recon_error = 1; - raidPtr->reconControl->error = 1; + raidPtr->reconControl->error = 1; /* an error was encountered at the very end... bail */ } else { #if RF_DEBUG_RECON @@ -726,10 +726,10 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) if (recon_error) { /* we've encountered an error in reconstructing. */ printf("raid%d: reconstruction failed.\n", raidPtr->raidid); - + /* we start by blocking IO to the RAID set. */ rf_SuspendNewRequestsAndWait(raidPtr); - + RF_LOCK_MUTEX(raidPtr->mutex); /* mark set as being degraded, rather than rf_rs_reconstructing as we were before the problem. @@ -739,10 +739,10 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) */ raidPtr->status = rf_rs_degraded; RF_UNLOCK_MUTEX(raidPtr->mutex); - + /* resume IO */ - rf_ResumeNewRequests(raidPtr); - + rf_ResumeNewRequests(raidPtr); + /* At this point there are two cases: 1) If we've experienced a read error, then we've already waited for all the reads we're going to get, @@ -753,7 +753,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) but there is little point in waiting for the writes -- when they do complete, they will just be ignored. - So we just wait for writes to complete if we didn't have a + So we just wait for writes to complete if we didn't have a write error. */ @@ -765,7 +765,7 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) status = ProcessReconEvent(raidPtr, event); if (status == RF_RECON_WRITE_ERROR) { - raidPtr->reconControl->error = 1; + raidPtr->reconControl->error = 1; /* an error was encountered at the very end... bail. This will be very bad news for the user, since at this point there will have been a read error @@ -776,14 +776,14 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) } } - + /* cleanup */ /* drain the event queue - after waiting for the writes above, there shouldn't be much (if anything!) left in the queue. */ rf_DrainReconEventQueue(reconDesc); - + /* XXX As much as we'd like to free the recon control structure and the reconDesc, we have no way of knowing if/when those will be touched by IO that has yet to occur. It is rather poor to be @@ -810,9 +810,9 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) * the array here to assure no nasty interactions with pending * user accesses when we free up the psstatus structure as * part of FreeReconControl() */ - + rf_SuspendNewRequestsAndWait(raidPtr); - + RF_LOCK_MUTEX(raidPtr->mutex); raidPtr->numFailures--; ds = (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE); @@ -821,16 +821,16 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) RF_UNLOCK_MUTEX(raidPtr->mutex); RF_GETTIME(etime); RF_TIMEVAL_DIFF(&(raidPtr->reconControl->starttime), &etime, &elpsd); - + rf_ResumeNewRequests(raidPtr); - - printf("raid%d: Reconstruction of disk at col %d completed\n", + + 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", - raidPtr->raidid, - (int) elpsd.tv_sec, (int) elpsd.tv_usec, + raidPtr->raidid, + (int) elpsd.tv_sec, (int) elpsd.tv_usec, 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, @@ -846,14 +846,14 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) RF_Free(raidPtr->recon_tracerecs, raidPtr->numCol * sizeof(RF_AccTraceEntry_t)); #endif FreeReconDesc(reconDesc); - + return (0); } /***************************************************************************** * do the right thing upon each reconstruction event. *****************************************************************************/ -static int +static int ProcessReconEvent(RF_Raid_t *raidPtr, RF_ReconEvent_t *event) { int retcode = 0, submitblocked; @@ -905,7 +905,7 @@ ProcessReconEvent(RF_Raid_t *raidPtr, RF_ReconEvent_t *event) if (rbuf->type == RF_RBUF_TYPE_FLOATING) { RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex); while(raidPtr->reconControl->rb_lock) { - ltsleep(&raidPtr->reconControl->rb_lock, PRIBIO, "reconctrlpre1", 0, + ltsleep(&raidPtr->reconControl->rb_lock, PRIBIO, "reconctrlpre1", 0, &raidPtr->reconControl->rb_mutex); } raidPtr->reconControl->rb_lock = 1; @@ -930,7 +930,7 @@ ProcessReconEvent(RF_Raid_t *raidPtr, RF_ReconEvent_t *event) * cleared */ Dprintf1("RECON: BUFCLEAR EVENT: col %d\n", event->col); if (!raidPtr->reconControl->error) { - submitblocked = rf_SubmitReconBuffer(raidPtr->reconControl->perDiskInfo[event->col].rbuf, + 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 @@ -973,7 +973,7 @@ ProcessReconEvent(RF_Raid_t *raidPtr, RF_ReconEvent_t *event) * recon'd while we were waiting for something else to happen */ case RF_REVENT_SKIP: DDprintf1("RECON: SKIP EVENT: col %d\n", event->col); - if (!raidPtr->reconControl->error) { + if (!raidPtr->reconControl->error) { retcode = IssueNextReadRequest(raidPtr, event->col); } break; @@ -1041,7 +1041,7 @@ ProcessReconEvent(RF_Raid_t *raidPtr, RF_ReconEvent_t *event) * head separation or reconstruction-blockage events. * *****************************************************************************/ -static int +static int IssueNextReadRequest(RF_Raid_t *raidPtr, RF_RowCol_t col) { RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl->perDiskInfo[col]; @@ -1116,10 +1116,10 @@ IssueNextReadRequest(RF_Raid_t *raidPtr, RF_RowCol_t col) * indicated RU being blocked due to a write by a user thread. In * this case, we issue a head-sep or blockage wait request, which will * cause this same routine to be invoked again later when the blockage - * has cleared. + * has cleared. */ -static int +static int TryToRead(RF_Raid_t *raidPtr, RF_RowCol_t col) { RF_PerDiskReconCtrl_t *ctrl = &raidPtr->reconControl->perDiskInfo[col]; @@ -1224,8 +1224,8 @@ out: * since the calls to the mapping module are kept to a minimum. * * ASSUMES THAT THE STRIPE IDENTIFIER IDENTIFIES THE DISKS COMPRISING - * THE STRIPE IN THE CORRECT ORDER - * + * THE STRIPE IN THE CORRECT ORDER + * * raidPtr - raid descriptor * psid - parity stripe identifier * col - column of disk to find the offsets for @@ -1235,7 +1235,7 @@ out: */ -static int +static int ComputePSDiskOffsets(RF_Raid_t *raidPtr, RF_StripeNum_t psid, RF_RowCol_t col, RF_SectorNum_t *outDiskOffset, RF_SectorNum_t *outFailedDiskSectorOffset, @@ -1341,7 +1341,7 @@ skipit: return (1); } /* this is called when a buffer has become ready to write to the replacement disk */ -static int +static int IssueNextWriteRequest(RF_Raid_t *raidPtr) { RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; @@ -1376,7 +1376,7 @@ IssueNextWriteRequest(RF_Raid_t *raidPtr) #if RF_ACC_TRACE > 0 &raidPtr->recon_tracerecs[fcol], #else - NULL, + NULL, #endif (void *) raidPtr, 0, NULL, PR_WAITOK); @@ -1395,9 +1395,9 @@ IssueNextWriteRequest(RF_Raid_t *raidPtr) * control structure for the process that just finished a read. * * called at interrupt context in the kernel, so don't do anything - * illegal here. + * illegal here. */ -static int +static int ReconReadDoneProc(void *arg, int status) { RF_PerDiskReconCtrl_t *ctrl = (RF_PerDiskReconCtrl_t *) arg; @@ -1432,7 +1432,7 @@ ReconReadDoneProc(void *arg, int status) * * called at interrupt context in the kernel, so don't do anything illegal here. */ -static int +static int ReconWriteDoneProc(void *arg, int status) { RF_ReconBuffer_t *rbuf = (RF_ReconBuffer_t *) arg; @@ -1455,11 +1455,11 @@ ReconWriteDoneProc(void *arg, int status) } -/* +/* * computes a new minimum head sep, and wakes up anyone who needs to - * be woken as a result + * be woken as a result */ -static void +static void CheckForNewMinHeadSep(RF_Raid_t *raidPtr, RF_HeadSepLimit_t hsCtr) { RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl; @@ -1514,9 +1514,9 @@ CheckForNewMinHeadSep(RF_Raid_t *raidPtr, RF_HeadSepLimit_t hsCtr) * some very nasty, albeit fairly rare, reconstruction behavior. * * returns non-zero if and only if we have to stop working on the - * indicated disk due to a head-separation delay. + * indicated disk due to a head-separation delay. */ -static int +static int CheckHeadSeparation(RF_Raid_t *raidPtr, RF_PerDiskReconCtrl_t *ctrl, RF_RowCol_t col, RF_HeadSepLimit_t hsCtr, RF_ReconUnitNum_t which_ru) @@ -1531,7 +1531,7 @@ CheckHeadSeparation(RF_Raid_t *raidPtr, RF_PerDiskReconCtrl_t *ctrl, * We define "caught up" with 20% hysteresis, i.e. the head separation * must have fallen to at most 80% of the max allowable head * separation before we'll wake up. - * + * */ RF_LOCK_MUTEX(reconCtrlPtr->rb_mutex); while(reconCtrlPtr->rb_lock) { @@ -1542,8 +1542,8 @@ CheckHeadSeparation(RF_Raid_t *raidPtr, RF_PerDiskReconCtrl_t *ctrl, if ((raidPtr->headSepLimit >= 0) && ((ctrl->headSepCounter - reconCtrlPtr->minHeadSepCounter) > raidPtr->headSepLimit)) { Dprintf5("raid%d: RECON: head sep stall: col %d hsCtr %ld minHSCtr %ld limit %ld\n", - raidPtr->raidid, col, ctrl->headSepCounter, - reconCtrlPtr->minHeadSepCounter, + raidPtr->raidid, col, ctrl->headSepCounter, + reconCtrlPtr->minHeadSepCounter, raidPtr->headSepLimit); cb = rf_AllocCallbackDesc(); /* the minHeadSepCounter value we have to get to before we'll @@ -1578,14 +1578,14 @@ CheckHeadSeparation(RF_Raid_t *raidPtr, RF_PerDiskReconCtrl_t *ctrl, return (retval); } -/* +/* * checks to see if reconstruction has been either forced or blocked * by a user operation. if forced, we skip this RU entirely. else if * blocked, put ourselves on the wait list. else return 0. * - * ASSUMES THE PSS MUTEX IS LOCKED UPON ENTRY + * ASSUMES THE PSS MUTEX IS LOCKED UPON ENTRY */ -static int +static int CheckForcedOrBlockedReconstruction(RF_Raid_t *raidPtr, RF_ReconParityStripeStatus_t *pssPtr, RF_PerDiskReconCtrl_t *ctrl, @@ -1620,9 +1620,9 @@ CheckForcedOrBlockedReconstruction(RF_Raid_t *raidPtr, * indicate that the caller must wait. If not, then reconstruction is * blocked on the indicated stripe and the routine returns zero. If * and only if we return non-zero, we'll cause the cbFunc to get - * invoked with the cbArg when the reconstruction has completed. + * invoked with the cbArg when the reconstruction has completed. */ -int +int rf_ForceOrBlockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, void (*cbFunc)(RF_Raid_t *, void *), void *cbArg) { @@ -1712,7 +1712,7 @@ rf_ForceOrBlockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, /* if the write is sitting in the disk queue, elevate its * priority */ if (rf_DiskIOPromote(&raidPtr->Queues[fcol], psid, which_ru)) - printf("raid%d: promoted write to col %d\n", + printf("raid%d: promoted write to col %d\n", raidPtr->raidid, fcol); } /* install a callback descriptor to be invoked when recon completes on @@ -1724,7 +1724,7 @@ rf_ForceOrBlockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, cb->callbackArg.p = (void *) cbArg; cb->next = pssPtr->procWaitList; pssPtr->procWaitList = cb; - DDprintf2("raid%d: Waiting for forced recon on psid %ld\n", + DDprintf2("raid%d: Waiting for forced recon on psid %ld\n", raidPtr->raidid, psid); RF_UNLOCK_PSS_MUTEX(raidPtr, psid); @@ -1734,7 +1734,7 @@ rf_ForceOrBlockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap, * all we do is schedule the FORCEDREADONE event. * called at interrupt context in the kernel, so don't do anything illegal here. */ -static void +static void ForceReconReadDoneProc(void *arg, int status) { RF_ReconBuffer_t *rbuf = arg; @@ -1754,7 +1754,7 @@ ForceReconReadDoneProc(void *arg, int status) rf_CauseReconEvent(rbuf->raidPtr, rbuf->col, (void *) rbuf, RF_REVENT_FORCEDREADDONE); } /* releases a block on the reconstruction of the indicated stripe */ -int +int rf_UnblockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) { RF_StripeNum_t stripeID = asmap->stripeID; @@ -1791,7 +1791,7 @@ rf_UnblockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap) pssPtr->flags &= ~RF_PSS_RECON_BLOCKED; - while (pssPtr->blockWaitList) { + while (pssPtr->blockWaitList) { /* spin through the block-wait list and release all the waiters */ cb = pssPtr->blockWaitList; diff --git a/sys/dev/raidframe/rf_reconstruct.h b/sys/dev/raidframe/rf_reconstruct.h index 3b833146082..7d530d95fe1 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.19 2005/02/05 23:32:44 oster Exp $ */ +/* $NetBSD: rf_reconstruct.h,v 1.20 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -181,7 +181,7 @@ int rf_ReconstructFailedDiskBasic(RF_Raid_t *, RF_RowCol_t); int rf_ReconstructInPlace(RF_Raid_t *, RF_RowCol_t); int rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *); int rf_ForceOrBlockRecon(RF_Raid_t *, RF_AccessStripeMap_t *, - void (*cbFunc) (RF_Raid_t *, void *), + void (*cbFunc) (RF_Raid_t *, void *), void *); int rf_UnblockRecon(RF_Raid_t *, RF_AccessStripeMap_t *); diff --git a/sys/dev/raidframe/rf_reconutil.c b/sys/dev/raidframe/rf_reconutil.c index f40c1057d14..ed88aec95f3 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.24 2005/02/05 23:32:44 oster Exp $ */ +/* $NetBSD: rf_reconutil.c,v 1.25 2005/02/27 00:27:45 perry 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.24 2005/02/05 23:32:44 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.25 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.24 2005/02/05 23:32:44 oster Exp */ RF_ReconCtrl_t * -rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, +rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, RF_RowCol_t fcol, RF_RowCol_t scol) { RF_Raid_t *raidPtr = reconDesc->raidPtr; @@ -91,7 +91,7 @@ rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, reconCtrlPtr->perDiskInfo[i].reconCtrl = reconCtrlPtr; reconCtrlPtr->perDiskInfo[i].col = i; /* make it appear as if we just finished an RU */ - reconCtrlPtr->perDiskInfo[i].curPSID = -1; + reconCtrlPtr->perDiskInfo[i].curPSID = -1; reconCtrlPtr->perDiskInfo[i].ru_count = RUsPerPU - 1; } @@ -137,7 +137,7 @@ rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, reconCtrlPtr->floatingRbufs = NULL; reconCtrlPtr->committedRbufs = NULL; for (i = 0; i < raidPtr->numFloatingReconBufs; i++) { - rbuf = rf_MakeReconBuffer(raidPtr, fcol, + rbuf = rf_MakeReconBuffer(raidPtr, fcol, RF_RBUF_TYPE_FLOATING); rbuf->next = reconCtrlPtr->floatingRbufs; reconCtrlPtr->floatingRbufs = rbuf; @@ -152,7 +152,7 @@ rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc, return (reconCtrlPtr); } -void +void rf_FreeReconControl(RF_Raid_t *raidPtr) { RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl; @@ -173,7 +173,7 @@ rf_FreeReconControl(RF_Raid_t *raidPtr) rf_FreeReconMap(reconCtrlPtr->reconMap); rf_FreeParityStripeStatusTable(raidPtr, reconCtrlPtr->pssTable); - RF_Free(reconCtrlPtr->perDiskInfo, + RF_Free(reconCtrlPtr->perDiskInfo, raidPtr->numCol * sizeof(RF_PerDiskReconCtrl_t)); RF_Free(reconCtrlPtr, sizeof(*reconCtrlPtr)); } @@ -182,7 +182,7 @@ rf_FreeReconControl(RF_Raid_t *raidPtr) /****************************************************************************** * computes the default head separation limit *****************************************************************************/ -RF_HeadSepLimit_t +RF_HeadSepLimit_t rf_GetDefaultHeadSepLimit(RF_Raid_t *raidPtr) { RF_HeadSepLimit_t hsl; @@ -199,7 +199,7 @@ rf_GetDefaultHeadSepLimit(RF_Raid_t *raidPtr) /****************************************************************************** * computes the default number of floating recon buffers *****************************************************************************/ -int +int rf_GetDefaultNumFloatingReconBuffers(RF_Raid_t *raidPtr) { const RF_LayoutSW_t *lp; @@ -236,7 +236,7 @@ rf_MakeReconBuffer(RF_Raid_t *raidPtr, RF_RowCol_t col, RF_RbufType_t type) /****************************************************************************** * frees a reconstruction buffer *****************************************************************************/ -void +void rf_FreeReconBuffer(RF_ReconBuffer_t *rbuf) { RF_Raid_t *raidPtr = rbuf->raidPtr; @@ -253,7 +253,7 @@ XXXX IF you use this, you really want to fix the locking in here. /****************************************************************************** * debug only: sanity check the number of floating recon bufs in use *****************************************************************************/ -void +void rf_CheckFloatingRbufCount(RF_Raid_t *raidPtr, int dolock) { RF_ReconParityStripeStatus_t *p; @@ -286,17 +286,17 @@ rf_CheckFloatingRbufCount(RF_Raid_t *raidPtr, int dolock) RF_UNLOCK_MUTEX(pssTable[i].mutex); } - for (rbuf = raidPtr->reconControl->floatingRbufs; rbuf; + for (rbuf = raidPtr->reconControl->floatingRbufs; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; } - for (rbuf = raidPtr->reconControl->committedRbufs; rbuf; + for (rbuf = raidPtr->reconControl->committedRbufs; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; } - for (rbuf = raidPtr->reconControl->fullBufferList; rbuf; + for (rbuf = raidPtr->reconControl->fullBufferList; rbuf; rbuf = rbuf->next) { if (rbuf->type == RF_RBUF_TYPE_FLOATING) sum++; diff --git a/sys/dev/raidframe/rf_revent.c b/sys/dev/raidframe/rf_revent.c index 8697fdaecda..6251dddbd18 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.20 2005/02/05 23:32:44 oster Exp $ */ +/* $NetBSD: rf_revent.c,v 1.21 2005/02/27 00:27:45 perry 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.20 2005/02/05 23:32:44 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_revent.c,v 1.21 2005/02/27 00:27:45 perry Exp $"); #include <sys/errno.h> @@ -57,7 +57,7 @@ static void rf_ShutdownReconEvent(void *ignored) pool_destroy(&rf_pools.revent); } -int +int rf_ConfigureReconEvent(RF_ShutdownList_t **listp) { @@ -100,10 +100,10 @@ rf_GetNextReconEvent(RF_RaidReconDesc_t *reconDesc) RF_ETIMER_STOP(reconDesc->recon_exec_timer); RF_ETIMER_EVAL(reconDesc->recon_exec_timer); - reconDesc->reconExecTicks += + reconDesc->reconExecTicks += RF_ETIMER_VAL_US(reconDesc->recon_exec_timer); if (reconDesc->reconExecTicks > reconDesc->maxReconExecTicks) - reconDesc->maxReconExecTicks = + reconDesc->maxReconExecTicks = reconDesc->reconExecTicks; if (reconDesc->reconExecTicks >= MAX_RECON_EXEC_USECS) { /* we've been running too long. delay for @@ -112,7 +112,7 @@ rf_GetNextReconEvent(RF_RaidReconDesc_t *reconDesc) reconDesc->numReconExecDelays++; #endif /* RF_RECON_STATS > 0 */ - status = ltsleep(&reconDesc->reconExecTicks, PRIBIO, + status = ltsleep(&reconDesc->reconExecTicks, PRIBIO, "recon delay", RECON_TIMO, &rctrl->eq_mutex); RF_ASSERT(status == EWOULDBLOCK); @@ -146,8 +146,8 @@ rf_GetNextReconEvent(RF_RaidReconDesc_t *reconDesc) return (event); } /* enqueues a reconstruction event on the indicated queue */ -void -rf_CauseReconEvent(RF_Raid_t *raidPtr, RF_RowCol_t col, void *arg, +void +rf_CauseReconEvent(RF_Raid_t *raidPtr, RF_RowCol_t col, void *arg, RF_Revent_t type) { RF_ReconCtrl_t *rctrl = raidPtr->reconControl; @@ -195,7 +195,7 @@ rf_DrainReconEventQueue(RF_RaidReconDesc_t *reconDesc) RF_LOCK_MUTEX(rctrl->eq_mutex); while (rctrl->eventQueue!=NULL) { - + event = rctrl->eventQueue; rctrl->eventQueue = event->next; event->next = NULL; @@ -206,7 +206,7 @@ rf_DrainReconEventQueue(RF_RaidReconDesc_t *reconDesc) RF_UNLOCK_MUTEX(rctrl->eq_mutex); } -void +void rf_FreeReconEventDesc(RF_ReconEvent_t *event) { pool_put(&rf_pools.revent, event); diff --git a/sys/dev/raidframe/rf_shutdown.c b/sys/dev/raidframe/rf_shutdown.c index a6b7fbfbb5a..0967acea1ee 100644 --- a/sys/dev/raidframe/rf_shutdown.c +++ b/sys/dev/raidframe/rf_shutdown.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_shutdown.c,v 1.17 2004/03/09 02:15:33 oster Exp $ */ +/* $NetBSD: rf_shutdown.c,v 1.18 2005/02/27 00:27:45 perry Exp $ */ /* * rf_shutdown.c */ @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.17 2004/03/09 02:15:33 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.18 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.17 2004/03/09 02:15:33 oster Exp $ static void rf_FreeShutdownEnt(RF_ShutdownList_t *); -static void +static void rf_FreeShutdownEnt(RF_ShutdownList_t *ent) { FREE(ent, M_RAIDFRAME); @@ -71,9 +71,9 @@ _rf_ShutdownCreate(RF_ShutdownList_t **listp, void (*cleanup)(void *arg), * Have to directly allocate memory here, since we start up before * and shutdown after RAIDframe internal allocation system. */ - /* ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), + /* ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), M_RAIDFRAME, M_WAITOK); */ - ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), + ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), M_RAIDFRAME, M_WAITOK); ent->cleanup = cleanup; ent->arg = arg; diff --git a/sys/dev/raidframe/rf_shutdown.h b/sys/dev/raidframe/rf_shutdown.h index cb1381ecdea..0921952edd4 100644 --- a/sys/dev/raidframe/rf_shutdown.h +++ b/sys/dev/raidframe/rf_shutdown.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_shutdown.h,v 1.5 2004/03/09 02:15:33 oster Exp $ */ +/* $NetBSD: rf_shutdown.h,v 1.6 2005/02/27 00:27:45 perry Exp $ */ /* * rf_shutdown.h */ @@ -67,7 +67,7 @@ void _rf_ShutdownCreate(RF_ShutdownList_t **, void (*cleanup) (void *), #else #define rf_ShutdownCreate(_listp_,_func_,_arg_) \ _rf_ShutdownCreate(_listp_,_func_,_arg_) -void _rf_ShutdownCreate(RF_ShutdownList_t **, void (*cleanup) (void *), +void _rf_ShutdownCreate(RF_ShutdownList_t **, void (*cleanup) (void *), void *); #endif void rf_ShutdownList(RF_ShutdownList_t **); diff --git a/sys/dev/raidframe/rf_sstf.c b/sys/dev/raidframe/rf_sstf.c index 1df4b324050..fc4ef4eadac 100644 --- a/sys/dev/raidframe/rf_sstf.c +++ b/sys/dev/raidframe/rf_sstf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_sstf.c,v 1.11 2004/03/04 01:57:54 oster Exp $ */ +/* $NetBSD: rf_sstf.c,v 1.12 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ******************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_sstf.c,v 1.11 2004/03/04 01:57:54 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_sstf.c,v 1.12 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_sstf.c,v 1.11 2004/03/04 01:57:54 oster Exp $"); #define QSUM(_sstfq_) (((_sstfq_)->lopri.qlen)+((_sstfq_)->left.qlen)+((_sstfq_)->right.qlen)) -static void +static void do_sstf_ord_q(RF_DiskQueueData_t **, RF_DiskQueueData_t **, RF_DiskQueueData_t *); @@ -69,7 +69,7 @@ closest_to_arm(RF_SstfQ_t *, static void do_dequeue(RF_SstfQ_t *, RF_DiskQueueData_t *); -static void +static void do_sstf_ord_q(queuep, tailp, req) RF_DiskQueueData_t **queuep; RF_DiskQueueData_t **tailp; @@ -286,7 +286,7 @@ rf_CscanCreate(sect_per_disk, cl_list, listp) return ((void *) cscanq); } -void +void rf_SstfEnqueue(qptr, req, priority) void *qptr; RF_DiskQueueData_t *req; @@ -303,7 +303,7 @@ rf_SstfEnqueue(qptr, req, priority) dq = (RF_DiskQueue_t *) req->queue; printf("raid%d: ENQ lopri %d queues are %d,%d,%d\n", req->raidPtr->raidid, - dq->col, + dq->col, sstfq->left.qlen, sstfq->right.qlen, sstfq->lopri.qlen); } @@ -321,7 +321,7 @@ rf_SstfEnqueue(qptr, req, priority) } } -static void +static void do_dequeue(queue, req) RF_SstfQ_t *queue; RF_DiskQueueData_t *req; @@ -366,7 +366,7 @@ rf_SstfDequeue(qptr) dq = (RF_DiskQueue_t *) req->queue; RF_ASSERT(QSUM(sstfq) == dq->queueLength); printf("raid%d: sstf: Dequeue %d queues are %d,%d,%d\n", - req->raidPtr->raidid, dq->col, + req->raidPtr->raidid, dq->col, sstfq->left.qlen, sstfq->right.qlen, sstfq->lopri.qlen); } #endif @@ -430,8 +430,8 @@ rf_ScanDequeue(qptr) RF_DiskQueue_t *dq; dq = (RF_DiskQueue_t *) req->queue; RF_ASSERT(QSUM(scanq) == dq->queueLength); - printf("raid%d: scan: Dequeue %d queues are %d,%d,%d\n", - req->raidPtr->raidid, dq->col, + printf("raid%d: scan: Dequeue %d queues are %d,%d,%d\n", + req->raidPtr->raidid, dq->col, scanq->left.qlen, scanq->right.qlen, scanq->lopri.qlen); } #endif @@ -487,7 +487,7 @@ rf_CscanDequeue(qptr) RF_DiskQueue_t *dq; dq = (RF_DiskQueue_t *) req->queue; RF_ASSERT(QSUM(cscanq) == dq->queueLength); - printf("raid%d: scan: Dequeue %d queues are %d,%d,%d\n", + printf("raid%d: scan: Dequeue %d queues are %d,%d,%d\n", req->raidPtr->raidid, dq->col, cscanq->left.qlen, cscanq->right.qlen, cscanq->lopri.qlen); @@ -638,7 +638,7 @@ rf_CscanPeek(qptr) return (req); } -int +int rf_SstfPromote(qptr, parityStripeID, which_ru) void *qptr; RF_StripeNum_t parityStripeID; @@ -669,7 +669,7 @@ rf_SstfPromote(qptr, parityStripeID, which_ru) #if RF_DEBUG_QUEUE if (rf_sstfDebug || rf_scanDebug || rf_cscanDebug) { printf("raid%d: promoted %d matching I/Os queues are %d,%d,%d\n", - r->raidPtr->raidid, n, sstfq->left.qlen, + r->raidPtr->raidid, n, sstfq->left.qlen, sstfq->right.qlen, sstfq->lopri.qlen); } #endif diff --git a/sys/dev/raidframe/rf_sstf.h b/sys/dev/raidframe/rf_sstf.h index 18024ee9260..a3ac53fb158 100644 --- a/sys/dev/raidframe/rf_sstf.h +++ b/sys/dev/raidframe/rf_sstf.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_sstf.h,v 1.3 1999/02/05 00:06:17 oster Exp $ */ +/* $NetBSD: rf_sstf.h,v 1.4 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -58,7 +58,7 @@ rf_CscanCreate(RF_SectorCount_t sect_per_disk, void rf_SstfEnqueue(void *qptr, RF_DiskQueueData_t * req, int priority); RF_DiskQueueData_t *rf_SstfDequeue(void *qptr); RF_DiskQueueData_t *rf_SstfPeek(void *qptr); -int +int rf_SstfPromote(void *qptr, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru); RF_DiskQueueData_t *rf_ScanDequeue(void *qptr); diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c index aa7a3bdbf18..a08763ecbe1 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.37 2005/01/14 01:33:15 oster Exp $ */ +/* $NetBSD: rf_states.c,v 1.38 2005/02/27 00:27:45 perry 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.37 2005/01/14 01:33:15 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.38 2005/02/27 00:27:45 perry Exp $"); #include <sys/errno.h> @@ -92,7 +92,7 @@ StateName(RF_AccessState_t state) } #endif -void +void rf_ContinueRaidAccess(RF_RaidAccessDesc_t *desc) { int suspended = RF_FALSE; @@ -149,7 +149,7 @@ rf_ContinueRaidAccess(RF_RaidAccessDesc_t *desc) #if RF_DEBUG_STATES if (rf_printStatesDebug) { printf("raid%d: State: %-24s StateIndex: %3i desc: 0x%ld %s\n", - unit, StateName(current_state), + unit, StateName(current_state), current_state_index, (long) desc, suspended ? "callback scheduled" : "looping"); } @@ -160,7 +160,7 @@ rf_ContinueRaidAccess(RF_RaidAccessDesc_t *desc) } -void +void rf_ContinueDagAccess(RF_DagList_t *dagList) { #if RF_ACC_TRACE > 0 @@ -196,10 +196,10 @@ rf_ContinueDagAccess(RF_DagList_t *dagList) #if 0 printf("raid%d: DAG failure: %c addr 0x%lx " "(%ld) nblk 0x%x (%d) buf 0x%lx state %d\n", - desc->raidPtr->raidid, desc->type, + desc->raidPtr->raidid, desc->type, (long) desc->raidAddress, (long) desc->raidAddress, (int) desc->numBlocks, - (int) desc->numBlocks, + (int) desc->numBlocks, (unsigned long) (desc->bufPtr), desc->state); #endif } @@ -207,14 +207,14 @@ rf_ContinueDagAccess(RF_DagList_t *dagList) rf_ContinueRaidAccess(desc); } -int +int rf_State_LastState(RF_RaidAccessDesc_t *desc) { void (*callbackFunc) (RF_CBParam_t) = desc->callbackFunc; RF_CBParam_t callbackArg; callbackArg.p = desc->callbackArg; - + /* * If this is not an async request, wake up the caller */ @@ -227,17 +227,17 @@ rf_State_LastState(RF_RaidAccessDesc_t *desc) rf_disk_unbusy(desc); - /* + /* * Wakeup any requests waiting to go. */ - + RF_LOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex); ((RF_Raid_t *) desc->raidPtr)->openings++; RF_UNLOCK_MUTEX(((RF_Raid_t *) desc->raidPtr)->mutex); /* wake up any pending IO */ raidstart(((RF_Raid_t *) desc->raidPtr)); - + /* printf("Calling biodone on 0x%x\n",desc->bp); */ biodone(desc->bp); /* access came through ioctl */ @@ -248,7 +248,7 @@ rf_State_LastState(RF_RaidAccessDesc_t *desc) return RF_FALSE; } -int +int rf_State_IncrAccessCount(RF_RaidAccessDesc_t *desc) { RF_Raid_t *raidPtr; @@ -264,7 +264,7 @@ rf_State_IncrAccessCount(RF_RaidAccessDesc_t *desc) return RF_FALSE; } -int +int rf_State_DecrAccessCount(RF_RaidAccessDesc_t *desc) { RF_Raid_t *raidPtr; @@ -282,7 +282,7 @@ rf_State_DecrAccessCount(RF_RaidAccessDesc_t *desc) return RF_FALSE; } -int +int rf_State_Quiesce(RF_RaidAccessDesc_t *desc) { #if RF_ACC_TRACE > 0 @@ -347,7 +347,7 @@ rf_State_Quiesce(RF_RaidAccessDesc_t *desc) return suspended; } -int +int rf_State_Map(RF_RaidAccessDesc_t *desc) { RF_Raid_t *raidPtr = desc->raidPtr; @@ -372,7 +372,7 @@ rf_State_Map(RF_RaidAccessDesc_t *desc) return RF_FALSE; } -int +int rf_State_Lock(RF_RaidAccessDesc_t *desc) { #if RF_ACC_TRACE > 0 @@ -388,7 +388,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) #if RF_ACC_TRACE > 0 RF_ETIMER_START(timer); #endif - + /* acquire each lock that we don't already hold */ for (asm_p = asmh->stripeMap; asm_p; asm_p = asm_p->next) { RF_ASSERT(RF_IO_IS_R_OR_W(desc->type)); @@ -400,7 +400,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) /* locks must be acquired hierarchically */ RF_ASSERT(asm_p->stripeID > lastStripeID); lastStripeID = asm_p->stripeID; - + RF_INIT_LOCK_REQ_DESC(asm_p->lockReqDesc, desc->type, (void (*) (struct buf *)) rf_ContinueRaidAccess, desc, asm_p, raidPtr->Layout.dataSectorsPerStripe); @@ -414,7 +414,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) raidPtr->status == rf_rs_reconstructing) { if (!(asm_p->flags & RF_ASM_FLAGS_FORCE_TRIED)) { int val; - + asm_p->flags |= RF_ASM_FLAGS_FORCE_TRIED; val = rf_ForceOrBlockRecon(raidPtr, asm_p, (void (*) (RF_Raid_t *, void *)) rf_ContinueRaidAccess, desc); @@ -428,7 +428,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) #if RF_DEBUG_PSS > 0 if (rf_pssDebug) { printf("raid%d: skipping force/block because already done, psid %ld\n", - desc->raidPtr->raidid, + desc->raidPtr->raidid, (long) asm_p->stripeID); } #endif @@ -437,7 +437,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) #if RF_DEBUG_PSS > 0 if (rf_pssDebug) { printf("raid%d: skipping force/block because not write or not under recon, psid %ld\n", - desc->raidPtr->raidid, + desc->raidPtr->raidid, (long) asm_p->stripeID); } #endif @@ -475,7 +475,7 @@ rf_State_Lock(RF_RaidAccessDesc_t *desc) * else * done (FAIL) */ -int +int rf_State_CreateDAG(RF_RaidAccessDesc_t *desc) { #if RF_ACC_TRACE > 0 @@ -518,14 +518,14 @@ rf_State_CreateDAG(RF_RaidAccessDesc_t *desc) * dag libraries */ if (selectStatus) { printf("raid%d: failed to create a dag. " - "Too many component failures.\n", + "Too many component failures.\n", desc->raidPtr->raidid); } else { printf("raid%d: IO failed after %d retries.\n", desc->raidPtr->raidid, RF_RETRY_THRESHOLD); } - desc->status = 1; /* bad status */ + desc->status = 1; /* bad status */ /* skip straight to rf_State_Cleanup() */ desc->state = rf_CleanupState; bp = (struct buf *)desc->bp; @@ -559,7 +559,7 @@ rf_State_CreateDAG(RF_RaidAccessDesc_t *desc) * - this preserves atomic parity update * dags for independents parity groups (stripes) are fired concurrently */ -int +int rf_State_ExecuteDAG(RF_RaidAccessDesc_t *desc) { int i; @@ -600,7 +600,7 @@ rf_State_ExecuteDAG(RF_RaidAccessDesc_t *desc) * first, check to all dags in the access have completed * if not, fire as many dags as possible */ -int +int rf_State_ProcessDAG(RF_RaidAccessDesc_t *desc) { RF_AccessStripeMapHeader_t *asmh = desc->asmap; @@ -674,7 +674,7 @@ rf_State_ProcessDAG(RF_RaidAccessDesc_t *desc) } } /* only make it this far if all dags complete successfully */ -int +int rf_State_Cleanup(RF_RaidAccessDesc_t *desc) { #if RF_ACC_TRACE > 0 @@ -718,7 +718,7 @@ rf_State_Cleanup(RF_RaidAccessDesc_t *desc) asm_p->parityInfo && !(desc->flags & RF_DAG_SUPPRESS_LOCKS)) { RF_ASSERT_VALID_LOCKREQ(&asm_p->lockReqDesc); - rf_ReleaseStripeLock(raidPtr->lockTable, + rf_ReleaseStripeLock(raidPtr->lockTable, asm_p->stripeID, &asm_p->lockReqDesc); } diff --git a/sys/dev/raidframe/rf_stripelocks.c b/sys/dev/raidframe/rf_stripelocks.c index 275b797745a..c00e6bf96fc 100644 --- a/sys/dev/raidframe/rf_stripelocks.c +++ b/sys/dev/raidframe/rf_stripelocks.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_stripelocks.c,v 1.25 2004/03/07 22:15:19 oster Exp $ */ +/* $NetBSD: rf_stripelocks.c,v 1.26 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.25 2004/03/07 22:15:19 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.26 2005/02/27 00:27:45 perry Exp $"); #include <dev/raidframe/raidframevar.h> @@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.25 2004/03/07 22:15:19 oster Ex #include "rf_driver.h" #include "rf_shutdown.h" -#ifdef DEBUG +#ifdef DEBUG #define Dprintf1(s,a) rf_debug_printf(s,(void *)((unsigned long)a),NULL,NULL,NULL,NULL,NULL,NULL,NULL) #define Dprintf2(s,a,b) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),NULL,NULL,NULL,NULL,NULL,NULL) @@ -97,7 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.25 2004/03/07 22:15:19 oster Ex #define HASH_STRIPEID(_sid_) ( (_sid_) & (rf_lockTableSize-1) ) -static void AddToWaitersQueue(RF_StripeLockDesc_t * lockDesc, +static void AddToWaitersQueue(RF_StripeLockDesc_t * lockDesc, RF_LockReqDesc_t * lockReqDesc); static RF_StripeLockDesc_t *AllocStripeLockDesc(RF_StripeNum_t stripeID); static void FreeStripeLockDesc(RF_StripeLockDesc_t * p); @@ -157,13 +157,13 @@ static void rf_ShutdownStripeLocks(RF_LockTableEntry_t * lockTable); static void rf_ShutdownStripeLockFreeList(void *); static void rf_RaidShutdownStripeLocks(void *); -static void +static void rf_ShutdownStripeLockFreeList(void *ignored) { pool_destroy(&rf_pools.stripelock); } -int +int rf_ConfigureStripeLockFreeList(RF_ShutdownList_t **listp) { unsigned mask; @@ -188,8 +188,8 @@ rf_MakeLockTable() RF_LockTableEntry_t *lockTable; int i; - RF_Malloc(lockTable, - ((int) rf_lockTableSize) * sizeof(RF_LockTableEntry_t), + RF_Malloc(lockTable, + ((int) rf_lockTableSize) * sizeof(RF_LockTableEntry_t), (RF_LockTableEntry_t *)); if (lockTable == NULL) return (NULL); @@ -199,7 +199,7 @@ rf_MakeLockTable() return (lockTable); } -static void +static void rf_ShutdownStripeLocks(RF_LockTableEntry_t * lockTable) { @@ -211,14 +211,14 @@ rf_ShutdownStripeLocks(RF_LockTableEntry_t * lockTable) RF_Free(lockTable, rf_lockTableSize * sizeof(RF_LockTableEntry_t)); } -static void +static void rf_RaidShutdownStripeLocks(void *arg) { RF_Raid_t *raidPtr = (RF_Raid_t *) arg; rf_ShutdownStripeLocks(raidPtr->lockTable); } -int +int rf_ConfigureStripeLocks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr) { @@ -235,7 +235,7 @@ rf_ConfigureStripeLocks(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, * with cbArg when you are granted the lock. We store a tag in * *releaseTag that you need to give back to us when you release the * lock. */ -int +int rf_AcquireStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, RF_LockReqDesc_t *lockReqDesc) { @@ -269,13 +269,13 @@ rf_AcquireStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, newlockDesc = AllocStripeLockDesc(stripeID); RF_LOCK_MUTEX(lockTable[hashval].mutex); - for (lockDesc = lockTable[hashval].descList; lockDesc; + for (lockDesc = lockTable[hashval].descList; lockDesc; lockDesc = lockDesc->next) { if (lockDesc->stripeID == stripeID) break; } - if (!lockDesc) { + if (!lockDesc) { /* no entry in table => no one reading or writing */ lockDesc = newlockDesc; lockDesc->next = lockTable[hashval].descList; @@ -297,7 +297,7 @@ rf_AcquireStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, if (lockReqDesc->type == RF_IO_TYPE_WRITE) lockDesc->nWriters++; - if (lockDesc->nWriters == 0) { + if (lockDesc->nWriters == 0) { /* no need to search any lists if there are no * writers anywhere */ lockReqDesc->next = lockDesc->granted; @@ -328,7 +328,7 @@ rf_AcquireStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, } if (!retcode) { /* no conflicts found => grant lock */ - lockReqDesc->next = lockDesc->granted; + lockReqDesc->next = lockDesc->granted; lockDesc->granted = lockReqDesc; #if RF_DEBUG_STRIPELOCK if (rf_stripeLockDebug) { @@ -358,7 +358,7 @@ rf_AcquireStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, return (retcode); } -void +void rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, RF_LockReqDesc_t *lockReqDesc) { @@ -390,7 +390,7 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, RF_LOCK_MUTEX(lockTable[hashval].mutex); /* find the stripe lock descriptor */ - for (ld_t = NULL, lockDesc = lockTable[hashval].descList; + for (ld_t = NULL, lockDesc = lockTable[hashval].descList; lockDesc; ld_t = lockDesc, lockDesc = lockDesc->next) { if (lockDesc->stripeID == stripeID) break; @@ -422,14 +422,14 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, * check it against everything granted and against everything * _in front_ of it in the waiters queue. If it conflicts * with none of these, we release it. - * + * * DON'T TOUCH THE TEMPLINK POINTER OF ANYTHING IN THE GRANTED - * LIST HERE. + * LIST HERE. * * This will roach the case where the callback tries to * acquire a new lock in the same stripe. There are some * asserts to try and detect this. - * + * * We apply 2 performance optimizations: (1) if releasing this * lock results in no more writers to this stripe, we just * release everybody waiting, since we place no restrictions @@ -444,19 +444,19 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, if (lockDesc->nWriters == 0) { /* performance tweak (1) */ while (lockDesc->waitersH) { /* delete from waiters list */ - lr = lockDesc->waitersH; + lr = lockDesc->waitersH; lockDesc->waitersH = lr->next; RF_ASSERT(lr->type == RF_IO_TYPE_READ); /* add to granted list */ - lr->next = lockDesc->granted; + lr->next = lockDesc->granted; lockDesc->granted = lr; RF_ASSERT(!lr->templink); /* put on callback list so that we'll invoke callback below */ - lr->templink = callbacklist; + lr->templink = callbacklist; callbacklist = lr; #if RF_DEBUG_STRIPELOCK if (rf_stripeLockDebug) { @@ -466,11 +466,11 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, } #endif } - lockDesc->waitersT = NULL; + lockDesc->waitersT = NULL; /* we've purged the whole waiters list */ } else - for (candidate_t = NULL, candidate = lockDesc->waitersH; + for (candidate_t = NULL, candidate = lockDesc->waitersH; candidate;) { /* performance tweak (2) */ @@ -500,9 +500,9 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, * make sure it is not blocked by any granted * locks */ release_it = 1; - for (predecessor = lockDesc->granted; predecessor; + for (predecessor = lockDesc->granted; predecessor; predecessor = predecessor->next) { - if (STRIPELOCK_CONFLICT(candidate, + if (STRIPELOCK_CONFLICT(candidate, predecessor)) { #if RF_DEBUG_STRIPELOCK if (rf_stripeLockDebug) { @@ -521,10 +521,10 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, * blocked by any waiters that occur before it * it the wait queue */ if (release_it) - for (predecessor = lockDesc->waitersH; - predecessor != candidate; + for (predecessor = lockDesc->waitersH; + predecessor != candidate; predecessor = predecessor->next) { - if (STRIPELOCK_CONFLICT(candidate, + if (STRIPELOCK_CONFLICT(candidate, predecessor)) { #if RF_DEBUG_STRIPELOCK if (rf_stripeLockDebug) { @@ -559,26 +559,26 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, if (!lockDesc->waitersH) lockDesc->waitersT = NULL; } - /* move it to the granted list */ - candidate->next = lockDesc->granted; + /* move it to the granted list */ + candidate->next = lockDesc->granted; lockDesc->granted = candidate; RF_ASSERT(!candidate->templink); /* put it on the list of things to be called after we release the mutex */ - candidate->templink = callbacklist; + candidate->templink = callbacklist; callbacklist = candidate; if (!candidate_t) candidate = lockDesc->waitersH; else - candidate = candidate_t->next; + candidate = candidate_t->next; /* continue with the rest of the list */ } else { candidate_t = candidate; /* continue with the rest of the list */ - candidate = candidate->next; + candidate = candidate->next; } } @@ -607,7 +607,7 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, /* if we deleted the descriptor, we should have no callbacks * to do */ - RF_ASSERT(!((callbacklist) && (!lockDesc))); + RF_ASSERT(!((callbacklist) && (!lockDesc))); for (candidate = callbacklist; candidate;) { t = candidate; candidate = candidate->templink; @@ -616,7 +616,7 @@ rf_ReleaseStripeLock(RF_LockTableEntry_t *lockTable, RF_StripeNum_t stripeID, } } /* must have the indicated lock table mutex upon entry */ -static void +static void AddToWaitersQueue(RF_StripeLockDesc_t *lockDesc, RF_LockReqDesc_t *lockReqDesc) { if (!lockDesc->waitersH) { @@ -644,14 +644,14 @@ AllocStripeLockDesc(RF_StripeNum_t stripeID) return (p); } -static void +static void FreeStripeLockDesc(RF_StripeLockDesc_t *p) { pool_put(&rf_pools.stripelock, p); } #if RF_DEBUG_STRIPELOCK -static void +static void PrintLockedStripes(RF_LockTableEntry_t *lockTable) { int i, j, foundone = 0, did; @@ -665,14 +665,14 @@ PrintLockedStripes(RF_LockTableEntry_t *lockTable) foundone = 1; for (p = lockTable[i].descList; p; p = p->next) { printf("Stripe ID 0x%lx (%d) nWriters %d\n", - (long) p->stripeID, (int) p->stripeID, + (long) p->stripeID, (int) p->stripeID, p->nWriters); if (!(p->granted)) printf("Granted: (none)\n"); else printf("Granted:\n"); - for (did = 1, j = 0, q = p->granted; q; + for (did = 1, j = 0, q = p->granted; q; j++, q = q->next) { printf(" %c(%ld-%ld", q->type, (long) q->start, (long) q->stop); if (q->start2 != -1) @@ -693,7 +693,7 @@ PrintLockedStripes(RF_LockTableEntry_t *lockTable) printf("Waiting: (none)\n"); else printf("Waiting:\n"); - for (did = 1, j = 0, q = p->waitersH; q; + for (did = 1, j = 0, q = p->waitersH; q; j++, q = q->next) { printf("%c(%ld-%ld", q->type, (long) q->start, (long) q->stop); if (q->start2 != -1) diff --git a/sys/dev/raidframe/rf_utils.c b/sys/dev/raidframe/rf_utils.c index ecb9005af8b..0f5e0f9bd4b 100644 --- a/sys/dev/raidframe/rf_utils.c +++ b/sys/dev/raidframe/rf_utils.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_utils.c,v 1.12 2003/12/30 21:59:03 oster Exp $ */ +/* $NetBSD: rf_utils.c,v 1.13 2005/02/27 00:27:45 perry Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ****************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_utils.c,v 1.12 2003/12/30 21:59:03 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_utils.c,v 1.13 2005/02/27 00:27:45 perry Exp $"); #include "rf_archs.h" #include "rf_utils.h" @@ -56,7 +56,7 @@ rf_make_2d_array(int b, int k, RF_AllocListElem_t *allocList) #if (RF_INCLUDE_PARITY_DECLUSTERING > 0) || (RF_INCLUDE_PARITY_DECLUSTERING_PQ > 0) -void +void rf_free_2d_array(RF_RowCol_t **a, int b, int k) { RF_RowCol_t i; @@ -78,7 +78,7 @@ rf_make_1d_array(int c, RF_AllocListElem_t *allocList) return (retval); } -void +void rf_free_1d_array(RF_RowCol_t *a, int n) { RF_Free(a, n * sizeof(RF_RowCol_t)); @@ -87,7 +87,7 @@ rf_free_1d_array(RF_RowCol_t *a, int n) /* Euclid's algorithm: finds and returns the greatest common divisor * between a and b. (MCH) */ -int +int rf_gcd(int m, int n) { int t; @@ -110,7 +110,7 @@ rf_gcd(int m, int n) #define HC2INT(x) ( ((x) >= 'a' && (x) <= 'f') ? (x) - 'a' + 10 : \ ( ((x) >= 'A' && (x) <= 'F') ? (x) - 'A' + 10 : (x - '0') ) ) -int +int rf_atoi(char *p) { int val = 0, negate = 0; @@ -124,7 +124,7 @@ rf_atoi(char *p) return ((negate) ? -val : val); } -int +int rf_htoi(char *p) { int val = 0; |
