⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rf_layout.c

📁 RAIDFrame是个非常好的磁盘阵列RAID仿真工具
💻 C
📖 第 1 页 / 共 2 页
字号:
	NULL, NULL,	NULL,	rf_VerifyParityBasic,	2,	DefaultStates,	0)	},#endif /* RF_INCLUDE_DECL_PQ > 0 */#if RF_INCLUDE_RAID5_RS > 0	/* RAID 5 with rotated sparing */	{'R', "RAID Level 5 rotated sparing",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureRAID5_RS,	rf_MapSectorRAID5_RS, rf_MapParityRAID5_RS, NULL,	rf_IdentifyStripeRAID5_RS,	rf_RaidFiveDagSelect,	rf_MapSIDToPSIDRAID5_RS,	rf_GetDefaultHeadSepLimitRAID5,	rf_GetDefaultNumFloatingReconBuffersRAID5,	rf_GetNumSpareRUsRAID5_RS, NULL,	rf_SubmitReconBufferBasic,	rf_VerifyParityBasic,	1,	DefaultStates,	RF_DISTRIBUTE_SPARE)	},#endif /* RF_INCLUDE_RAID5_RS > 0 */#if RF_INCLUDE_CHAINDECLUSTER > 0	/* Chained Declustering */	{'C', "Chained Declustering",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureChainDecluster,	rf_MapSectorChainDecluster, rf_MapParityChainDecluster, NULL,	rf_IdentifyStripeChainDecluster,	rf_RAIDCDagSelect,	rf_MapSIDToPSIDChainDecluster,	NULL,	NULL,	rf_GetNumSpareRUsChainDecluster, NULL,	rf_SubmitReconBufferBasic,	rf_VerifyParityBasic,	1,	DefaultStates,	0)	},#endif /* RF_INCLUDE_CHAINDECLUSTER > 0 */#if RF_INCLUDE_INTERDECLUSTER > 0	/* Interleaved Declustering */	{'I', "Interleaved Declustering",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureInterDecluster,	rf_MapSectorInterDecluster, rf_MapParityInterDecluster, NULL,	rf_IdentifyStripeInterDecluster,	rf_RAIDIDagSelect,	rf_MapSIDToPSIDInterDecluster,	rf_GetDefaultHeadSepLimitInterDecluster,	rf_GetDefaultNumFloatingReconBuffersInterDecluster,	rf_GetNumSpareRUsInterDecluster, NULL,	rf_SubmitReconBufferBasic,	rf_VerifyParityBasic,	1,	DefaultStates,	RF_DISTRIBUTE_SPARE)	},#endif /* RF_INCLUDE_INTERDECLUSTER > 0 */#if RF_INCLUDE_RAID0 > 0	/* RAID level 0 */	{'0', "RAID Level 0",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureRAID0,	rf_MapSectorRAID0, rf_MapParityRAID0, NULL,	rf_IdentifyStripeRAID0,	rf_RAID0DagSelect,	rf_MapSIDToPSIDRAID0,	NULL,	NULL,	NULL, NULL,	NULL,	rf_VerifyParityRAID0,	0,	DefaultStates,	0)	},#endif /* RF_INCLUDE_RAID0 > 0 */#if RF_INCLUDE_RAID1 > 0	/* RAID level 1 */	{'1', "RAID Level 1",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureRAID1,	rf_MapSectorRAID1, rf_MapParityRAID1, NULL,	rf_IdentifyStripeRAID1,	rf_RAID1DagSelect,	rf_MapSIDToPSIDRAID1,	NULL,	NULL,	NULL, NULL,	rf_SubmitReconBufferRAID1,	rf_VerifyParityRAID1,	1,	DefaultStates,	0)	},#endif /* RF_INCLUDE_RAID1 > 0 */#if RF_INCLUDE_RAID4 > 0	/* RAID level 4 */	{'4', "RAID Level 4",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureRAID4,	rf_MapSectorRAID4, rf_MapParityRAID4, NULL,	rf_IdentifyStripeRAID4,	rf_RaidFiveDagSelect,	rf_MapSIDToPSIDRAID4,	rf_GetDefaultHeadSepLimitRAID4,	rf_GetDefaultNumFloatingReconBuffersRAID4,	NULL, NULL,	rf_SubmitReconBufferBasic,	rf_VerifyParityBasic,	1,	DefaultStates,	0)	},#endif /* RF_INCLUDE_RAID4 > 0 */#if RF_INCLUDE_RAID5 > 0	/* RAID level 5 */	{'5', "RAID Level 5",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureRAID5,	rf_MapSectorRAID5, rf_MapParityRAID5, NULL,	rf_IdentifyStripeRAID5,	rf_RaidFiveDagSelect,	rf_MapSIDToPSIDRAID5,	rf_GetDefaultHeadSepLimitRAID5,	rf_GetDefaultNumFloatingReconBuffersRAID5,	NULL, NULL,	rf_SubmitReconBufferBasic,	rf_VerifyParityBasic,	1,	DefaultStates,	0)	},#endif /* RF_INCLUDE_RAID5 > 0 */#if RF_INCLUDE_EVENODD > 0	/* Evenodd */	{'E', "EvenOdd",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureEvenOdd,	rf_MapSectorRAID5, rf_MapParityEvenOdd, rf_MapEEvenOdd, 	rf_IdentifyStripeEvenOdd,	rf_EODagSelect,	rf_MapSIDToPSIDRAID5,	NULL,	NULL,	NULL, NULL,	NULL, /* no reconstruction, yet */	rf_VerifyParityEvenOdd,	2,	DefaultStates,	0)	},#endif /* RF_INCLUDE_EVENODD > 0 */#if RF_INCLUDE_EVENODD > 0	/* Declustered Evenodd */	{'e', "Declustered EvenOdd",	RF_NK2(rf_MakeLayoutSpecificDeclustered, &distSpareNo)	RF_NU(	rf_ConfigureDeclusteredPQ,	rf_MapSectorDeclusteredPQ, rf_MapParityDeclusteredPQ, rf_MapQDeclusteredPQ,	rf_IdentifyStripeDeclusteredPQ,	rf_EODagSelect,	rf_MapSIDToPSIDRAID5,	rf_GetDefaultHeadSepLimitDeclustered,	rf_GetDefaultNumFloatingReconBuffersPQ,	NULL, NULL,	NULL, /* no reconstruction, yet */	rf_VerifyParityEvenOdd,	2,	DefaultStates,	0)	},#endif /* RF_INCLUDE_EVENODD > 0 */#if RF_INCLUDE_PARITYLOGGING > 0	/* parity logging */	{'L', "Parity logging",	RF_NK2(rf_MakeLayoutSpecificNULL, NULL)	RF_NU(	rf_ConfigureParityLogging,	rf_MapSectorParityLogging, rf_MapParityParityLogging, NULL,	rf_IdentifyStripeParityLogging,	rf_ParityLoggingDagSelect,	rf_MapSIDToPSIDParityLogging,	rf_GetDefaultHeadSepLimitParityLogging,	rf_GetDefaultNumFloatingReconBuffersParityLogging,	NULL, NULL,	rf_SubmitReconBufferBasic,	NULL,	1,	DefaultStates,	0)	},#endif /* RF_INCLUDE_PARITYLOGGING > 0 */	/* end-of-list marker */	{ '\0', NULL,	RF_NK2(NULL, NULL)	RF_NU(	NULL,	NULL, NULL, NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL, NULL,	NULL,	NULL,	0,	NULL,	0)	}};RF_LayoutSW_t *rf_GetLayout(RF_ParityConfig_t parityConfig){  RF_LayoutSW_t *p;  /* look up the specific layout */  for (p=&mapsw[0]; p->parityConfig; p++)     if (p->parityConfig == parityConfig)      break;  if (!p->parityConfig)    return(NULL);  RF_ASSERT(p->parityConfig == parityConfig);  return(p);}#if RF_UTILITY == 0/***************************************************************************************** * * ConfigureLayout --  * * read the configuration file and set up the RAID layout parameters.  After reading * common params, invokes the layout-specific configuration routine to finish * the configuration. * ****************************************************************************************/int rf_ConfigureLayout(  RF_ShutdownList_t  **listp,  RF_Raid_t           *raidPtr,  RF_Config_t         *cfgPtr){  RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout);  RF_ParityConfig_t parityConfig;  RF_LayoutSW_t *p;  int retval;  layoutPtr->sectorsPerStripeUnit = cfgPtr->sectPerSU;  layoutPtr->SUsPerPU             = cfgPtr->SUsPerPU;  layoutPtr->SUsPerRU             = cfgPtr->SUsPerRU;  parityConfig                    = cfgPtr->parityConfig;      layoutPtr->stripeUnitsPerDisk = raidPtr->sectorsPerDisk / layoutPtr->sectorsPerStripeUnit;  p = rf_GetLayout(parityConfig);  if (p == NULL) {    RF_ERRORMSG1("Unknown parity configuration '%c'", parityConfig);    return(EINVAL);  }  RF_ASSERT(p->parityConfig == parityConfig);  layoutPtr->map = p;  /* initialize the specific layout */  retval = (p->Configure)(listp, raidPtr, cfgPtr);  if (retval)    return(retval);  layoutPtr->dataBytesPerStripe = layoutPtr->dataSectorsPerStripe << raidPtr->logBytesPerSector;  raidPtr->sectorsPerDisk = layoutPtr->stripeUnitsPerDisk * layoutPtr->sectorsPerStripeUnit;  if (rf_forceNumFloatingReconBufs >= 0) {    raidPtr->numFloatingReconBufs = rf_forceNumFloatingReconBufs;  }  else {    raidPtr->numFloatingReconBufs = rf_GetDefaultNumFloatingReconBuffers(raidPtr);  }  if (rf_forceHeadSepLimit >= 0) {    raidPtr->headSepLimit = rf_forceHeadSepLimit;  }  else {    raidPtr->headSepLimit = rf_GetDefaultHeadSepLimit(raidPtr);  }  printf("RAIDFRAME: Configure (%s): total number of sectors is %lu (%lu MB)\n",     layoutPtr->map->configName,     (unsigned long)raidPtr->totalSectors,     (unsigned long)(raidPtr->totalSectors / 1024 * (1<<raidPtr->logBytesPerSector) / 1024));  if (raidPtr->headSepLimit >= 0) {    printf("RAIDFRAME(%s): Using %ld floating recon bufs with head sep limit %ld\n",      layoutPtr->map->configName, (long)raidPtr->numFloatingReconBufs, (long)raidPtr->headSepLimit);  }  else {    printf("RAIDFRAME(%s): Using %ld floating recon bufs with no head sep limit\n",      layoutPtr->map->configName, (long)raidPtr->numFloatingReconBufs);  }  return(0);}/* typically there is a 1-1 mapping between stripes and parity stripes. * however, the declustering code supports packing multiple stripes into * a single parity stripe, so as to increase the size of the reconstruction * unit without affecting the size of the stripe unit.  This routine finds * the parity stripe identifier associated with a stripe ID.  There is also * a RaidAddressToParityStripeID macro in layout.h */RF_StripeNum_t rf_MapStripeIDToParityStripeID(layoutPtr, stripeID, which_ru)  RF_RaidLayout_t    *layoutPtr;  RF_StripeNum_t      stripeID;  RF_ReconUnitNum_t  *which_ru;{  RF_StripeNum_t parityStripeID;  /* quick exit in the common case of SUsPerPU==1 */  if ((layoutPtr->SUsPerPU == 1) || !layoutPtr->map->MapSIDToPSID) {    *which_ru = 0;    return(stripeID);  }  else {    (layoutPtr->map->MapSIDToPSID)(layoutPtr, stripeID, &parityStripeID, which_ru);  }  return(parityStripeID);}#endif /* RF_UTILITY == 0 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -