rf_map.h revision 1.1 1 /* $NetBSD: rf_map.h,v 1.1 1998/11/13 04:20:31 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 (at) 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 /* rf_map.h */
30
31 /* :
32 * Log: rf_map.h,v
33 * Revision 1.9 1996/07/22 19:52:16 jimz
34 * switched node params to RF_DagParam_t, a union of
35 * a 64-bit int and a void *, for better portability
36 * attempted hpux port, but failed partway through for
37 * lack of a single C compiler capable of compiling all
38 * source files
39 *
40 * Revision 1.8 1996/06/10 11:55:47 jimz
41 * Straightened out some per-array/not-per-array distinctions, fixed
42 * a couple bugs related to confusion. Added shutdown lists. Removed
43 * layout shutdown function (now subsumed by shutdown lists).
44 *
45 * Revision 1.7 1996/06/07 21:33:04 jimz
46 * begin using consistent types for sector numbers,
47 * stripe numbers, row+col numbers, recon unit numbers
48 *
49 * Revision 1.6 1996/05/31 22:26:54 jimz
50 * fix a lot of mapping problems, memory allocation problems
51 * found some weird lock issues, fixed 'em
52 * more code cleanup
53 *
54 * Revision 1.5 1996/05/30 11:29:41 jimz
55 * Numerous bug fixes. Stripe lock release code disagreed with the taking code
56 * about when stripes should be locked (I made it consistent: no parity, no lock)
57 * There was a lot of extra serialization of I/Os which I've removed- a lot of
58 * it was to calculate values for the cache code, which is no longer with us.
59 * More types, function, macro cleanup. Added code to properly quiesce the array
60 * on shutdown. Made a lot of stuff array-specific which was (bogusly) general
61 * before. Fixed memory allocation, freeing bugs.
62 *
63 * Revision 1.4 1996/05/23 21:46:35 jimz
64 * checkpoint in code cleanup (release prep)
65 * lots of types, function names have been fixed
66 *
67 * Revision 1.3 1996/05/18 19:51:34 jimz
68 * major code cleanup- fix syntax, make some types consistent,
69 * add prototypes, clean out dead code, et cetera
70 *
71 * Revision 1.2 1995/12/01 19:25:14 root
72 * added copyright info
73 *
74 */
75
76 #ifndef _RF__RF_MAP_H_
77 #define _RF__RF_MAP_H_
78
79 #include "rf_types.h"
80 #include "rf_alloclist.h"
81 #include "rf_raid.h"
82
83 /* mapping structure allocation and free routines */
84 RF_AccessStripeMapHeader_t *rf_MapAccess(RF_Raid_t *raidPtr,
85 RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks,
86 caddr_t buffer, int remap);
87
88 void rf_MarkFailuresInASMList(RF_Raid_t *raidPtr,
89 RF_AccessStripeMapHeader_t *asm_h);
90
91 RF_AccessStripeMap_t *rf_DuplicateASM(RF_AccessStripeMap_t *asmap);
92
93 RF_PhysDiskAddr_t *rf_DuplicatePDA(RF_PhysDiskAddr_t *pda);
94
95 int rf_ConfigureMapModule(RF_ShutdownList_t **listp);
96
97 RF_AccessStripeMapHeader_t *rf_AllocAccessStripeMapHeader(void);
98
99 void rf_FreeAccessStripeMapHeader(RF_AccessStripeMapHeader_t *p);
100
101 RF_PhysDiskAddr_t *rf_AllocPhysDiskAddr(void);
102
103 RF_PhysDiskAddr_t *rf_AllocPDAList(int count);
104
105 void rf_FreePhysDiskAddr(RF_PhysDiskAddr_t *p);
106
107 RF_AccessStripeMap_t *rf_AllocAccessStripeMapComponent(void);
108
109 RF_AccessStripeMap_t *rf_AllocASMList(int count);
110
111 void rf_FreeAccessStripeMapComponent(RF_AccessStripeMap_t *p);
112
113 void rf_FreeAccessStripeMap(RF_AccessStripeMapHeader_t *hdr);
114
115 int rf_CheckStripeForFailures(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap);
116
117 int rf_NumFailedDataUnitsInStripe(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap);
118
119 void rf_PrintAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h);
120
121 void rf_PrintFullAccessStripeMap(RF_AccessStripeMapHeader_t *asm_h, int prbuf);
122
123 void rf_PrintRaidAddressInfo(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
124 RF_SectorCount_t numBlocks);
125
126 void rf_ASMParityAdjust(RF_PhysDiskAddr_t *toAdjust,
127 RF_StripeNum_t startAddrWithinStripe, RF_SectorNum_t endAddress,
128 RF_RaidLayout_t *layoutPtr, RF_AccessStripeMap_t *asm_p);
129
130 void rf_ASMCheckStatus(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda_p,
131 RF_AccessStripeMap_t *asm_p, RF_RaidDisk_t **disks, int parity);
132
133 #endif /* !_RF__RF_MAP_H_ */
134