1 /* $OpenBSD: rf_decluster.h,v 1.3 2002/12/16 07:01:03 tdeval Exp $ */ 2 /* $NetBSD: rf_decluster.h,v 1.3 1999/02/05 00:06:09 oster Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Carnegie-Mellon University. 6 * All rights reserved. 7 * 8 * Author: Mark Holland 9 * 10 * Permission to use, copy, modify and distribute this software and 11 * its documentation is hereby granted, provided that both the copyright 12 * notice and this permission notice appear in all copies of the 13 * software, derivative works or modified versions, and any portions 14 * thereof, and that both notices appear in supporting documentation. 15 * 16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19 * 20 * Carnegie Mellon requests users of this software to return to 21 * 22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23 * School of Computer Science 24 * Carnegie Mellon University 25 * Pittsburgh PA 15213-3890 26 * 27 * any improvements or extensions that they make and grant Carnegie the 28 * rights to redistribute these changes. 29 */ 30 31 /***************************************************************************** 32 * 33 * decluster.h -- Header file for declustered layout code. 34 * 35 * Adapted from raidSim version July 1994 36 * Created 10-21-92 (MCH) 37 * 38 *****************************************************************************/ 39 40 #ifndef _RF__RF_DECLUSTER_H_ 41 #define _RF__RF_DECLUSTER_H_ 42 43 #include "rf_types.h" 44 45 /* 46 * These structures define the tables used to locate the spare unit 47 * associated with a particular data or parity unit, and to perform 48 * the associated inverse mapping. 49 */ 50 struct RF_SpareTableEntry_s { 51 u_int spareDisk; /* Disk where this block is spared. */ 52 u_int spareBlockOffsetInSUs; /* 53 * Offset into spare table for that 54 * disk. 55 */ 56 }; 57 58 #define RF_SPAREMAP_NAME_LEN 128 59 60 /* 61 * This is the layout-specific info structure for the declustered layout. 62 */ 63 struct RF_DeclusteredConfigInfo_s { 64 /* Number of stripe units per parity stripe. */ 65 RF_StripeCount_t groupSize; 66 /* The block design table. */ 67 RF_RowCol_t **LayoutTable; 68 RF_RowCol_t **OffsetTable; 69 /* The sector offset table. */ 70 RF_RowCol_t **BlockTable; 71 /* The block membership table. */ 72 RF_StripeCount_t SUsPerFullTable; 73 /* Stripe units per full table. */ 74 RF_StripeCount_t SUsPerTable; 75 /* Stripe units per table. */ 76 RF_StripeCount_t PUsPerBlock; 77 /* Parity units per block. */ 78 RF_StripeCount_t SUsPerBlock; 79 /* Stripe units per block. */ 80 RF_StripeCount_t BlocksPerTable; 81 /* Block design tuples per table. */ 82 RF_StripeCount_t NumParityReps; 83 /* Tables per full table. */ 84 RF_StripeCount_t TableDepthInPUs; 85 /* PUs on one disk in 1 table. */ 86 RF_StripeCount_t FullTableDepthInPUs; 87 /* PUs on one disk in 1 fulltable. */ 88 RF_StripeCount_t FullTableLimitSUID; 89 /* SU where partial fulltables start. */ 90 RF_StripeCount_t ExtraTablesPerDisk; 91 /* Number of tables in last fulltable. */ 92 RF_SectorNum_t DiskOffsetOfLastFullTableInSUs; 93 /* Disk offsets of partial fulltable, if any. */ 94 RF_StripeCount_t numCompleteFullTablesPerDisk; 95 /* Fulltable identifier of partial fulltable, if any. */ 96 u_int Lambda; 97 /* The pair count in the block design. */ 98 99 /* These are used only in the distributed-sparing case. */ 100 RF_StripeCount_t FullTablesPerSpareRegion; 101 /* Number of fulltables comprising 1 spare region. */ 102 RF_StripeCount_t TablesPerSpareRegion; 103 /* Number of tables. */ 104 RF_SectorCount_t SpareSpaceDepthPerRegionInSUs; 105 /* Spare space/disk/region. */ 106 RF_SectorCount_t SpareRegionDepthInSUs; 107 /* Number of units/disk/region. */ 108 RF_SectorNum_t DiskOffsetOfLastSpareSpaceChunkInSUs; 109 /* Locates spare space after partial fulltable. */ 110 RF_StripeCount_t TotSparePUsPerDisk; 111 /* Total number of spare PUs per disk. */ 112 RF_StripeCount_t NumCompleteSRs; 113 RF_SpareTableEntry_t **SpareTable; 114 /* Remap table for spare space. */ 115 char sparemap_fname[RF_SPAREMAP_NAME_LEN]; 116 /* Where to find sparemap. Not used in kernel. */ 117 }; 118 119 int rf_ConfigureDeclustered(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *); 120 int rf_ConfigureDeclusteredDS(RF_ShutdownList_t **, RF_Raid_t *, 121 RF_Config_t *); 122 123 void rf_MapSectorDeclustered(RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t *, 124 RF_RowCol_t *, RF_SectorNum_t *, int); 125 void rf_MapParityDeclustered(RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t *, 126 RF_RowCol_t *, RF_SectorNum_t *, int); 127 void rf_IdentifyStripeDeclustered(RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t **, 128 RF_RowCol_t *); 129 void rf_MapSIDToPSIDDeclustered(RF_RaidLayout_t *, RF_StripeNum_t, 130 RF_StripeNum_t *, RF_ReconUnitNum_t *); 131 int rf_InstallSpareTable(RF_Raid_t *, RF_RowCol_t, RF_RowCol_t); 132 void rf_FreeSpareTable(RF_Raid_t *); 133 134 RF_HeadSepLimit_t rf_GetDefaultHeadSepLimitDeclustered(RF_Raid_t *); 135 int rf_GetDefaultNumFloatingReconBuffersDeclustered(RF_Raid_t *); 136 137 void rf_decluster_adjust_params(RF_RaidLayout_t *, RF_StripeNum_t *, 138 RF_StripeCount_t *, RF_StripeCount_t *, RF_StripeNum_t *); 139 void rf_remap_to_spare_space(RF_RaidLayout_t *, RF_DeclusteredConfigInfo_t *, 140 RF_RowCol_t, RF_StripeNum_t, RF_StripeNum_t, RF_SectorNum_t, 141 RF_StripeNum_t, RF_StripeNum_t, RF_RowCol_t *, RF_StripeNum_t *); 142 int rf_SetSpareTable(RF_Raid_t *, void *); 143 RF_ReconUnitCount_t rf_GetNumSpareRUsDeclustered(RF_Raid_t *); 144 145 #endif /* ! _RF__RF_DECLUSTER_H_ */ 146