diff options
Diffstat (limited to 'include/linux/raid/raid5.h')
-rw-r--r-- | include/linux/raid/raid5.h | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index f0827d31ae6f..3b2672792457 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -158,6 +158,43 @@ | |||
158 | * the compute block completes. | 158 | * the compute block completes. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | /* | ||
162 | * Operations state - intermediate states that are visible outside of sh->lock | ||
163 | * In general _idle indicates nothing is running, _run indicates a data | ||
164 | * processing operation is active, and _result means the data processing result | ||
165 | * is stable and can be acted upon. For simple operations like biofill and | ||
166 | * compute that only have an _idle and _run state they are indicated with | ||
167 | * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN) | ||
168 | */ | ||
169 | /** | ||
170 | * enum check_states - handles syncing / repairing a stripe | ||
171 | * @check_state_idle - check operations are quiesced | ||
172 | * @check_state_run - check operation is running | ||
173 | * @check_state_result - set outside lock when check result is valid | ||
174 | * @check_state_compute_run - check failed and we are repairing | ||
175 | * @check_state_compute_result - set outside lock when compute result is valid | ||
176 | */ | ||
177 | enum check_states { | ||
178 | check_state_idle = 0, | ||
179 | check_state_run, /* parity check */ | ||
180 | check_state_check_result, | ||
181 | check_state_compute_run, /* parity repair */ | ||
182 | check_state_compute_result, | ||
183 | }; | ||
184 | |||
185 | /** | ||
186 | * enum reconstruct_states - handles writing or expanding a stripe | ||
187 | */ | ||
188 | enum reconstruct_states { | ||
189 | reconstruct_state_idle = 0, | ||
190 | reconstruct_state_prexor_drain_run, /* prexor-write */ | ||
191 | reconstruct_state_drain_run, /* write */ | ||
192 | reconstruct_state_run, /* expand */ | ||
193 | reconstruct_state_prexor_drain_result, | ||
194 | reconstruct_state_drain_result, | ||
195 | reconstruct_state_result, | ||
196 | }; | ||
197 | |||
161 | struct stripe_head { | 198 | struct stripe_head { |
162 | struct hlist_node hash; | 199 | struct hlist_node hash; |
163 | struct list_head lru; /* inactive_list or handle_list */ | 200 | struct list_head lru; /* inactive_list or handle_list */ |
@@ -169,19 +206,13 @@ struct stripe_head { | |||
169 | spinlock_t lock; | 206 | spinlock_t lock; |
170 | int bm_seq; /* sequence number for bitmap flushes */ | 207 | int bm_seq; /* sequence number for bitmap flushes */ |
171 | int disks; /* disks in stripe */ | 208 | int disks; /* disks in stripe */ |
209 | enum check_states check_state; | ||
210 | enum reconstruct_states reconstruct_state; | ||
172 | /* stripe_operations | 211 | /* stripe_operations |
173 | * @pending - pending ops flags (set for request->issue->complete) | ||
174 | * @ack - submitted ops flags (set for issue->complete) | ||
175 | * @complete - completed ops flags (set for complete) | ||
176 | * @target - STRIPE_OP_COMPUTE_BLK target | 212 | * @target - STRIPE_OP_COMPUTE_BLK target |
177 | * @count - raid5_runs_ops is set to run when this is non-zero | ||
178 | */ | 213 | */ |
179 | struct stripe_operations { | 214 | struct stripe_operations { |
180 | unsigned long pending; | ||
181 | unsigned long ack; | ||
182 | unsigned long complete; | ||
183 | int target; | 215 | int target; |
184 | int count; | ||
185 | u32 zero_sum_result; | 216 | u32 zero_sum_result; |
186 | } ops; | 217 | } ops; |
187 | struct r5dev { | 218 | struct r5dev { |
@@ -202,6 +233,7 @@ struct stripe_head_state { | |||
202 | int locked, uptodate, to_read, to_write, failed, written; | 233 | int locked, uptodate, to_read, to_write, failed, written; |
203 | int to_fill, compute, req_compute, non_overwrite; | 234 | int to_fill, compute, req_compute, non_overwrite; |
204 | int failed_num; | 235 | int failed_num; |
236 | unsigned long ops_request; | ||
205 | }; | 237 | }; |
206 | 238 | ||
207 | /* r6_state - extra state data only relevant to r6 */ | 239 | /* r6_state - extra state data only relevant to r6 */ |
@@ -228,9 +260,7 @@ struct r6_state { | |||
228 | #define R5_Wantfill 12 /* dev->toread contains a bio that needs | 260 | #define R5_Wantfill 12 /* dev->toread contains a bio that needs |
229 | * filling | 261 | * filling |
230 | */ | 262 | */ |
231 | #define R5_Wantprexor 13 /* distinguish blocks ready for rmw from | 263 | #define R5_Wantdrain 13 /* dev->towrite needs to be drained */ |
232 | * other "towrites" | ||
233 | */ | ||
234 | /* | 264 | /* |
235 | * Write method | 265 | * Write method |
236 | */ | 266 | */ |
@@ -254,8 +284,10 @@ struct r6_state { | |||
254 | #define STRIPE_EXPAND_READY 11 | 284 | #define STRIPE_EXPAND_READY 11 |
255 | #define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ | 285 | #define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */ |
256 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ | 286 | #define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ |
287 | #define STRIPE_BIOFILL_RUN 14 | ||
288 | #define STRIPE_COMPUTE_RUN 15 | ||
257 | /* | 289 | /* |
258 | * Operations flags (in issue order) | 290 | * Operation request flags |
259 | */ | 291 | */ |
260 | #define STRIPE_OP_BIOFILL 0 | 292 | #define STRIPE_OP_BIOFILL 0 |
261 | #define STRIPE_OP_COMPUTE_BLK 1 | 293 | #define STRIPE_OP_COMPUTE_BLK 1 |
@@ -263,14 +295,6 @@ struct r6_state { | |||
263 | #define STRIPE_OP_BIODRAIN 3 | 295 | #define STRIPE_OP_BIODRAIN 3 |
264 | #define STRIPE_OP_POSTXOR 4 | 296 | #define STRIPE_OP_POSTXOR 4 |
265 | #define STRIPE_OP_CHECK 5 | 297 | #define STRIPE_OP_CHECK 5 |
266 | #define STRIPE_OP_IO 6 | ||
267 | |||
268 | /* modifiers to the base operations | ||
269 | * STRIPE_OP_MOD_REPAIR_PD - compute the parity block and write it back | ||
270 | * STRIPE_OP_MOD_DMA_CHECK - parity is not corrupted by the check | ||
271 | */ | ||
272 | #define STRIPE_OP_MOD_REPAIR_PD 7 | ||
273 | #define STRIPE_OP_MOD_DMA_CHECK 8 | ||
274 | 298 | ||
275 | /* | 299 | /* |
276 | * Plugging: | 300 | * Plugging: |