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