This source file includes following definitions.
- RF_LayoutSW_t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 #ifndef _RF__RF_LAYOUT_H_
36 #define _RF__RF_LAYOUT_H_
37
38 #include "rf_types.h"
39 #include "rf_archs.h"
40 #include "rf_alloclist.h"
41
42 #ifndef _KERNEL
43 #include <stdio.h>
44 #endif
45
46
47
48
49
50
51
52 typedef struct RF_LayoutSW_s {
53 RF_ParityConfig_t parityConfig;
54 const char *configName;
55
56 #ifndef _KERNEL
57
58 int (*MakeLayoutSpecific)
59 (FILE *, RF_Config_t *, void *);
60 void *makeLayoutSpecificArg;
61 #endif
62
63 #if RF_UTILITY == 0
64
65 int (*Configure)
66 (RF_ShutdownList_t **, RF_Raid_t *,
67 RF_Config_t *);
68
69
70 void (*MapSector)
71 (RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t *,
72 RF_RowCol_t *, RF_SectorNum_t *, int);
73
74
75
76
77
78 void (*MapParity)
79 (RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t *,
80 RF_RowCol_t *, RF_SectorNum_t *, int);
81
82
83 void (*MapQ)
84 (RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t *,
85 RF_RowCol_t *, RF_SectorNum_t *, int);
86
87
88 void (*IdentifyStripe)
89 (RF_Raid_t *, RF_RaidAddr_t, RF_RowCol_t **,
90 RF_RowCol_t *);
91
92
93 void (*SelectionFunc)
94 (RF_Raid_t *, RF_IoType_t,
95 RF_AccessStripeMap_t *, RF_VoidFuncPtr *);
96 #if 0
97 void (**createFunc)
98 (RF_Raid_t *, RF_AccessStripeMap_t *,
99 RF_DagHeader_t *, void *,
100 RF_RaidAccessFlags_t, RF_AllocListElem_t *);
101 #endif
102
103
104
105
106
107 void (*MapSIDToPSID)
108 (RF_RaidLayout_t *, RF_StripeNum_t,
109 RF_StripeNum_t *, RF_ReconUnitNum_t *);
110
111
112 RF_HeadSepLimit_t (*GetDefaultHeadSepLimit) (RF_Raid_t *);
113
114
115 int (*GetDefaultNumFloatingReconBuffers)
116 (RF_Raid_t *);
117
118
119 RF_ReconUnitCount_t (*GetNumSpareRUs) (RF_Raid_t *);
120
121
122 int (*InstallSpareTable)
123 (RF_Raid_t *, RF_RowCol_t, RF_RowCol_t);
124
125
126 int (*SubmitReconBuffer)
127 (RF_ReconBuffer_t *, int, int);
128
129
130
131
132
133 int (*VerifyParity)
134 (RF_Raid_t *, RF_RaidAddr_t,
135 RF_PhysDiskAddr_t *, int,
136 RF_RaidAccessFlags_t);
137
138
139 int faultsTolerated;
140
141
142
143
144
145 RF_AccessState_t *states;
146
147 RF_AccessStripeMapFlags_t flags;
148 #endif
149 } RF_LayoutSW_t;
150
151
152 #define RF_REMAP 1
153 #define RF_DONT_REMAP 0
154
155
156
157
158 #define RF_NO_STRIPE_LOCKS 0x0001
159 #define RF_DISTRIBUTE_SPARE 0x0002
160
161
162
163 #define RF_BD_DECLUSTERED 0x0004
164
165
166
167
168
169
170
171
172
173
174
175 struct RF_RaidLayout_s {
176
177 RF_SectorCount_t sectorsPerStripeUnit;
178
179
180
181
182 RF_StripeCount_t SUsPerPU;
183
184
185 RF_StripeCount_t SUsPerRU;
186
187
188
189
190
191
192
193
194 RF_StripeCount_t numStripe;
195
196
197
198 RF_SectorCount_t dataSectorsPerStripe;
199 RF_StripeCount_t dataStripeUnitsPerDisk;
200 u_int bytesPerStripeUnit;
201 u_int dataBytesPerStripe;
202 RF_StripeCount_t numDataCol;
203
204
205
206
207 RF_StripeCount_t numParityCol;
208
209
210
211
212 RF_StripeCount_t numParityLogCol;
213
214
215
216
217
218 RF_StripeCount_t stripeUnitsPerDisk;
219
220 RF_LayoutSW_t *map;
221
222
223
224 void *layoutSpecificInfo;
225
226
227
228 };
229
230
231
232
233
234
235
236
237
238
239
240
241
242 #define RF_PDA_TYPE_DATA 0
243 #define RF_PDA_TYPE_PARITY 1
244 #define RF_PDA_TYPE_Q 2
245
246 struct RF_PhysDiskAddr_s {
247 RF_RowCol_t row, col;
248 RF_SectorNum_t startSector;
249
250
251 RF_SectorCount_t numSector;
252
253
254 int type;
255
256
257
258
259 caddr_t bufPtr;
260
261
262
263 RF_RaidAddr_t raidAddress;
264
265
266
267
268 RF_PhysDiskAddr_t *next;
269 };
270 #define RF_MAX_FAILED_PDA RF_MAXCOL
271
272 struct RF_AccessStripeMap_s {
273 RF_StripeNum_t stripeID;
274 RF_RaidAddr_t raidAddress;
275
276
277
278 RF_RaidAddr_t endRaidAddress;
279
280
281
282 RF_SectorCount_t totalSectorsAccessed;
283
284
285
286
287 RF_StripeCount_t numStripeUnitsAccessed;
288
289
290
291
292 int numDataFailed;
293
294
295
296 int numParityFailed;
297
298
299
300
301 int numQFailed;
302
303
304
305 RF_AccessStripeMapFlags_t flags;
306 #if 0
307 RF_PhysDiskAddr_t *failedPDA;
308
309
310
311 RF_PhysDiskAddr_t *failedPDAtwo;
312
313
314
315 #else
316 int numFailedPDAs;
317
318
319 RF_PhysDiskAddr_t *failedPDAs[RF_MAX_FAILED_PDA];
320
321
322
323 #endif
324 RF_PhysDiskAddr_t *physInfo;
325
326
327
328 RF_PhysDiskAddr_t *parityInfo;
329
330
331
332 RF_PhysDiskAddr_t *qInfo;
333
334
335
336 RF_LockReqDesc_t lockReqDesc;
337 RF_RowCol_t origRow;
338
339
340
341
342 RF_AccessStripeMap_t *next;
343 };
344
345 #define RF_ASM_REDIR_LARGE_WRITE 0x00000001
346
347
348
349
350
351 #define RF_ASM_BAILOUT_DAG_USED 0x00000002
352
353
354
355
356
357 #define RF_ASM_FLAGS_LOCK_TRIED 0x00000004
358
359
360
361
362
363 #define RF_ASM_FLAGS_LOCK_TRIED2 0x00000008
364
365
366
367
368
369 #define RF_ASM_FLAGS_FORCE_TRIED 0x00000010
370
371
372
373
374 #define RF_ASM_FLAGS_RECON_BLOCKED 0x00000020
375
376
377
378
379
380 struct RF_AccessStripeMapHeader_s {
381 RF_StripeCount_t numStripes;
382
383
384
385 RF_AccessStripeMap_t *stripeMap;
386
387
388
389 RF_AccessStripeMapHeader_t *next;
390 };
391
392
393
394
395
396
397
398
399
400
401 #define rf_RaidAddressToStripeID(_layoutPtr_,_addr_) \
402 (((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit) / \
403 (_layoutPtr_)->numDataCol)
404
405
406 #define rf_StripeIDToRaidAddress(_layoutPtr_,_sid_) \
407 (((_sid_) * (_layoutPtr_)->sectorsPerStripeUnit) * \
408 (_layoutPtr_)->numDataCol)
409
410
411 #define rf_StripeUnitIDToStripeID(_layoutPtr_,_addr_) \
412 ((_addr_) / (_layoutPtr_)->numDataCol)
413
414
415 #define rf_RaidAddressToStripeUnitID(_layoutPtr_,_addr_) \
416 (((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit))
417
418
419 #define rf_RaidAddressOfNextStripeBoundary(_layoutPtr_,_addr_) \
420 ((((_addr_) / (_layoutPtr_)->dataSectorsPerStripe) + 1) * \
421 (_layoutPtr_)->dataSectorsPerStripe)
422
423
424
425
426
427 #define rf_RaidAddressOfPrevStripeBoundary(_layoutPtr_,_addr_) \
428 ((((_addr_) / (_layoutPtr_)->dataSectorsPerStripe) + 0) * \
429 (_layoutPtr_)->dataSectorsPerStripe)
430
431
432
433
434
435 #define rf_RaidAddressOfNextStripeUnitBoundary(_layoutPtr_,_addr_) \
436 ((((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit) + 1L) * \
437 (_layoutPtr_)->sectorsPerStripeUnit)
438
439
440
441
442
443 #define rf_RaidAddressOfPrevStripeUnitBoundary(_layoutPtr_,_addr_) \
444 ((((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit) + 0) * \
445 (_layoutPtr_)->sectorsPerStripeUnit)
446
447
448 #define rf_RaidAddressStripeOffset(_layoutPtr_,_addr_) \
449 ((_addr_) % (_layoutPtr_)->dataSectorsPerStripe)
450
451
452 #define rf_StripeUnitOffset(_layoutPtr_,_addr_) \
453 ((_addr_) % (_layoutPtr_)->sectorsPerStripeUnit)
454
455
456 #define rf_RaidAddressStripeAligned(__layoutPtr__,__addr__) \
457 (rf_RaidAddressStripeOffset(__layoutPtr__, __addr__) == 0)
458
459
460 #define rf_StripeUnitAligned(__layoutPtr__,__addr__) \
461 (rf_StripeUnitOffset(__layoutPtr__, __addr__) == 0)
462
463
464
465
466
467 #define rf_RaidAddressToByte(_raidPtr_,_addr_) \
468 ((_addr_) << (_raidPtr_)->logBytesPerSector)
469
470 #define rf_ByteToRaidAddress(_raidPtr_,_addr_) \
471 ((_addr_) >> (_raidPtr_)->logBytesPerSector)
472
473
474
475
476
477
478
479 #define rf_RaidAddressToParityStripeID(_layoutPtr_,_addr_,_ru_num_) \
480 rf_MapStripeIDToParityStripeID((_layoutPtr_), \
481 rf_RaidAddressToStripeID((_layoutPtr_), (_addr_)), (_ru_num_))
482
483 #define rf_ParityStripeIDToRaidAddress(_layoutPtr_,_psid_) \
484 ((_psid_) * (_layoutPtr_)->SUsPerPU * \
485 (_layoutPtr_)->numDataCol * (_layoutPtr_)->sectorsPerStripeUnit)
486
487 RF_LayoutSW_t *rf_GetLayout(RF_ParityConfig_t);
488 int rf_ConfigureLayout(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *);
489 RF_StripeNum_t rf_MapStripeIDToParityStripeID(RF_RaidLayout_t *,
490 RF_StripeNum_t, RF_ReconUnitNum_t *);
491
492 #endif