6b13f685e
김민수
BSP 최초 추가
|
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
|
#ifndef _RAID5_H
#define _RAID5_H
#include <linux/raid/xor.h>
#include <linux/dmaengine.h>
enum check_states {
check_state_idle = 0,
check_state_run,
check_state_run_q,
check_state_run_pq,
check_state_check_result,
check_state_compute_run,
check_state_compute_result,
};
enum reconstruct_states {
reconstruct_state_idle = 0,
reconstruct_state_prexor_drain_run,
reconstruct_state_drain_run,
reconstruct_state_run,
reconstruct_state_prexor_drain_result,
reconstruct_state_drain_result,
reconstruct_state_result,
};
struct stripe_head {
struct hlist_node hash;
struct list_head lru;
struct llist_node release_list;
struct r5conf *raid_conf;
short generation;
sector_t sector;
short pd_idx;
short qd_idx;
short ddf_layout;
short hash_lock_index;
unsigned long state;
atomic_t count;
int bm_seq;
int disks;
enum check_states check_state;
enum reconstruct_states reconstruct_state;
spinlock_t stripe_lock;
int cpu;
struct r5worker_group *group;
struct stripe_operations {
int target, target2;
enum sum_check_flags zero_sum_result;
} ops;
struct r5dev {
struct bio req, rreq;
struct bio_vec vec, rvec;
struct page *page;
struct bio *toread, *read, *towrite, *written;
sector_t sector;
unsigned long flags;
} dev[1];
};
struct stripe_head_state {
int syncing, expanding, expanded, replacing;
int locked, uptodate, to_read, to_write, failed, written;
int to_fill, compute, req_compute, non_overwrite;
int failed_num[2];
int p_failed, q_failed;
int dec_preread_active;
unsigned long ops_request;
struct bio *return_bi;
struct md_rdev *blocked_rdev;
int handle_bad_blocks;
};
enum r5dev_flags {
R5_UPTODATE,
R5_LOCKED,
R5_DOUBLE_LOCKED,
R5_OVERWRITE,
R5_Insync,
R5_Wantread,
R5_Wantwrite,
R5_Overlap,
R5_ReadNoMerge,
R5_ReadError,
R5_ReWrite,
R5_Expanded,
R5_Wantcompute,
R5_Wantfill,
R5_Wantdrain,
R5_WantFUA,
R5_SyncIO,
R5_WriteError,
R5_MadeGood,
R5_ReadRepl,
R5_MadeGoodRepl,
R5_NeedReplace,
R5_WantReplace,
R5_Discard,
};
enum {
STRIPE_ACTIVE,
STRIPE_HANDLE,
STRIPE_SYNC_REQUESTED,
STRIPE_SYNCING,
STRIPE_INSYNC,
STRIPE_REPLACED,
STRIPE_PREREAD_ACTIVE,
STRIPE_DELAYED,
STRIPE_DEGRADED,
STRIPE_BIT_DELAY,
STRIPE_EXPANDING,
STRIPE_EXPAND_SOURCE,
STRIPE_EXPAND_READY,
STRIPE_IO_STARTED,
STRIPE_FULL_WRITE,
STRIPE_BIOFILL_RUN,
STRIPE_COMPUTE_RUN,
STRIPE_OPS_REQ_PENDING,
STRIPE_ON_UNPLUG_LIST,
STRIPE_DISCARD,
STRIPE_ON_RELEASE_LIST,
};
enum {
STRIPE_OP_BIOFILL,
STRIPE_OP_COMPUTE_BLK,
STRIPE_OP_PREXOR,
STRIPE_OP_BIODRAIN,
STRIPE_OP_RECONSTRUCT,
STRIPE_OP_CHECK,
};
struct disk_info {
struct md_rdev *rdev, *replacement;
};
#define NR_STRIPE_HASH_LOCKS 8
#define STRIPE_HASH_LOCKS_MASK (NR_STRIPE_HASH_LOCKS - 1)
struct r5worker {
struct work_struct work;
struct r5worker_group *group;
struct list_head temp_inactive_list[NR_STRIPE_HASH_LOCKS];
bool working;
};
struct r5worker_group {
struct list_head handle_list;
struct r5conf *conf;
struct r5worker *workers;
int stripes_cnt;
};
struct r5conf {
struct hlist_head *stripe_hashtbl;
spinlock_t hash_locks[NR_STRIPE_HASH_LOCKS];
struct mddev *mddev;
int chunk_sectors;
int level, algorithm;
int max_degraded;
int raid_disks;
int max_nr_stripes;
sector_t reshape_progress;
sector_t reshape_safe;
int previous_raid_disks;
int prev_chunk_sectors;
int prev_algo;
short generation;
seqcount_t gen_lock;
unsigned long reshape_checkpoint;
long long min_offset_diff;
struct list_head handle_list;
struct list_head hold_list;
struct list_head delayed_list;
struct list_head bitmap_list;
struct bio *retry_read_aligned;
struct bio *retry_read_aligned_list;
atomic_t preread_active_stripes;
atomic_t active_aligned_reads;
atomic_t pending_full_writes;
int bypass_count;
int bypass_threshold;
struct list_head *last_hold;
atomic_t reshape_stripes;
int active_name;
char cache_name[2][32];
struct kmem_cache *slab_cache;
int seq_flush, seq_write;
int quiesce;
int fullsync;
int recovery_disabled;
struct raid5_percpu {
struct page *spare_page;
void *scribble;
} __percpu *percpu;
size_t scribble_len;
#ifdef CONFIG_HOTPLUG_CPU
struct notifier_block cpu_notify;
#endif
atomic_t active_stripes;
struct list_head inactive_list[NR_STRIPE_HASH_LOCKS];
atomic_t empty_inactive_list_nr;
struct llist_head released_stripes;
wait_queue_head_t wait_for_stripe;
wait_queue_head_t wait_for_overlap;
int inactive_blocked;
int pool_size;
spinlock_t device_lock;
struct disk_info *disks;
struct md_thread *thread;
struct list_head temp_inactive_list[NR_STRIPE_HASH_LOCKS];
struct r5worker_group *worker_groups;
int group_cnt;
int worker_cnt_per_group;
};
#define ALGORITHM_LEFT_ASYMMETRIC 0 /* Rotating Parity N with Data Restart */
#define ALGORITHM_RIGHT_ASYMMETRIC 1 /* Rotating Parity 0 with Data Restart */
#define ALGORITHM_LEFT_SYMMETRIC 2 /* Rotating Parity N with Data Continuation */
#define ALGORITHM_RIGHT_SYMMETRIC 3 /* Rotating Parity 0 with Data Continuation */
#define ALGORITHM_PARITY_0 4 /* P or P,Q are initial devices */
#define ALGORITHM_PARITY_N 5 /* P or P,Q are final devices. */
#define ALGORITHM_ROTATING_ZERO_RESTART 8 /* DDF PRL=6 RLQ=1 */
#define ALGORITHM_ROTATING_N_RESTART 9 /* DDF PRL=6 RLQ=2 */
#define ALGORITHM_ROTATING_N_CONTINUE 10 /*DDF PRL=6 RLQ=3 */
#define ALGORITHM_LEFT_ASYMMETRIC_6 16
#define ALGORITHM_RIGHT_ASYMMETRIC_6 17
#define ALGORITHM_LEFT_SYMMETRIC_6 18
#define ALGORITHM_RIGHT_SYMMETRIC_6 19
#define ALGORITHM_PARITY_0_6 20
#define ALGORITHM_PARITY_N_6 ALGORITHM_PARITY_N
static inline int algorithm_valid_raid5(int layout)
{
return (layout >= 0) &&
(layout <= 5);
}
static inline int algorithm_valid_raid6(int layout)
{
return (layout >= 0 && layout <= 5)
||
(layout >= 8 && layout <= 10)
||
(layout >= 16 && layout <= 20);
}
static inline int algorithm_is_DDF(int layout)
{
return layout >= 8 && layout <= 10;
}
extern int md_raid5_congested(struct mddev *mddev, int bits);
extern void md_raid5_kick_device(struct r5conf *conf);
extern int raid5_set_cache_size(struct mddev *mddev, int size);
#endif
|