This source file includes following definitions.
- RF_STOP
- RF_UPDATE
- RF_OVERWRITE
- RF_ParityRecordType_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_PARITYLOG_H_
36 #define _RF__RF_PARITYLOG_H_
37
38 #include "rf_types.h"
39
40 #define RF_DEFAULT_NUM_SECTORS_PER_LOG 64
41
42 typedef int RF_RegionId_t;
43
44 typedef enum RF_ParityRecordType_e {
45 RF_STOP,
46 RF_UPDATE,
47 RF_OVERWRITE
48 } RF_ParityRecordType_t;
49
50 struct RF_CommonLogData_s {
51 RF_DECLARE_MUTEX(mutex);
52 int cnt;
53 RF_Raid_t *raidPtr;
54
55 int (*wakeFunc) (RF_DagNode_t *, int);
56 void *wakeArg;
57 RF_AccTraceEntry_t *tracerec;
58 RF_Etimer_t startTime;
59 caddr_t bufPtr;
60 RF_ParityRecordType_t operation;
61 RF_CommonLogData_t *next;
62 };
63
64 struct RF_ParityLogData_s {
65 RF_RegionId_t regionID;
66
67
68
69 int bufOffset;
70
71
72 RF_PhysDiskAddr_t diskAddress;
73 RF_CommonLogData_t *common;
74
75
76
77 RF_ParityLogData_t *next;
78 RF_ParityLogData_t *prev;
79 };
80
81 struct RF_ParityLogAppendQueue_s {
82 RF_DECLARE_MUTEX(mutex);
83 };
84
85 struct RF_ParityLogRecord_s {
86 RF_PhysDiskAddr_t parityAddr;
87 RF_ParityRecordType_t operation;
88 };
89
90 struct RF_ParityLog_s {
91 RF_RegionId_t regionID;
92 int numRecords;
93 int diskOffset;
94 RF_ParityLogRecord_t *records;
95 caddr_t bufPtr;
96 RF_ParityLog_t *next;
97 };
98
99 struct RF_ParityLogQueue_s {
100 RF_DECLARE_MUTEX(mutex);
101 RF_ParityLog_t *parityLogs;
102 };
103
104 struct RF_RegionBufferQueue_s {
105 RF_DECLARE_MUTEX(mutex);
106 RF_DECLARE_COND(cond);
107 int bufferSize;
108 int totalBuffers;
109 int availableBuffers;
110 int emptyBuffersIndex;
111 int availBuffersIndex;
112 caddr_t *buffers;
113 };
114 #define RF_PLOG_CREATED (1<<0)
115 #define RF_PLOG_RUNNING (1<<1)
116 #define RF_PLOG_TERMINATE (1<<2)
117 #define RF_PLOG_SHUTDOWN (1<<3)
118
119 struct RF_ParityLogDiskQueue_s {
120 RF_DECLARE_MUTEX(mutex);
121 RF_DECLARE_COND(cond);
122 int threadState;
123
124
125
126 RF_ParityLog_t *flushQueue;
127
128
129
130 RF_ParityLog_t *reintQueue;
131
132
133
134 RF_ParityLogData_t *bufHead;
135
136
137
138 RF_ParityLogData_t *bufTail;
139
140
141
142 RF_ParityLogData_t *reintHead;
143
144
145
146
147 RF_ParityLogData_t *reintTail;
148
149
150
151
152 RF_ParityLogData_t *logBlockHead;
153
154
155
156 RF_ParityLogData_t *logBlockTail;
157 RF_ParityLogData_t *reintBlockHead;
158
159
160
161
162 RF_ParityLogData_t *reintBlockTail;
163 RF_CommonLogData_t *freeCommonList;
164
165
166
167 RF_ParityLogData_t *freeDataList;
168
169
170
171 };
172
173 struct RF_DiskMap_s {
174 RF_PhysDiskAddr_t parityAddr;
175 RF_ParityRecordType_t operation;
176 };
177
178 struct RF_RegionInfo_s {
179 RF_DECLARE_MUTEX(mutex);
180
181
182
183 RF_DECLARE_MUTEX(reintMutex);
184 int reintInProgress;
185
186
187
188 RF_SectorCount_t capacity;
189
190
191
192 RF_SectorNum_t regionStartAddr;
193
194
195
196 RF_SectorNum_t parityStartAddr;
197
198
199
200 RF_SectorCount_t numSectorsParity;
201
202
203
204 RF_SectorCount_t diskCount;
205
206
207
208 RF_DiskMap_t *diskMap;
209
210
211
212 int loggingEnabled;
213
214
215
216 RF_ParityLog_t *coreLog;
217
218
219 };
220
221 RF_ParityLogData_t *rf_CreateParityLogData(RF_ParityRecordType_t,
222 RF_PhysDiskAddr_t *, caddr_t, RF_Raid_t *,
223 int (*) (RF_DagNode_t *, int), void *,
224 RF_AccTraceEntry_t *, RF_Etimer_t);
225 RF_ParityLogData_t *rf_SearchAndDequeueParityLogData(RF_Raid_t *, RF_RegionId_t,
226 RF_ParityLogData_t **, RF_ParityLogData_t **, int);
227 void rf_ReleaseParityLogs(RF_Raid_t *, RF_ParityLog_t *);
228 int rf_ParityLogAppend(RF_ParityLogData_t *, int, RF_ParityLog_t **, int);
229 void rf_EnableParityLogging(RF_Raid_t *);
230
231 #endif