aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-30 23:39:38 -0400
committerNeilBrown <neilb@suse.de>2009-03-30 23:39:38 -0400
commit99c0fb5f92828ae96909d390f2df137b89093b37 (patch)
tree67757972da005990d619b810c3b75fb8b6c9969f /drivers/md/raid5.h
parent911d4ee8536d89ea8a6cd3e96b1c95a3ebc5ea66 (diff)
md/raid5: Add support for new layouts for raid5 and raid6.
DDF uses different layouts for P and Q blocks than current md/raid6 so add those that are missing. Also add support for RAID6 layouts that are identical to various raid5 layouts with the simple addition of one device to hold all of the 'Q' blocks. Finally add 'raid5' layouts to match raid4. These last to will allow online level conversion. Note that this does not provide correct support for DDF/raid6 yet as the order in which data blocks are summed to produce the Q block is significant and different between current md code and DDF requirements. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.h')
-rw-r--r--drivers/md/raid5.h61
1 files changed, 57 insertions, 4 deletions
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 0c7375ad12bd..633d79289616 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -394,9 +394,62 @@ typedef struct raid5_private_data raid5_conf_t;
394/* 394/*
395 * Our supported algorithms 395 * Our supported algorithms
396 */ 396 */
397#define ALGORITHM_LEFT_ASYMMETRIC 0 397#define ALGORITHM_LEFT_ASYMMETRIC 0 /* Rotating Parity N with Data Restart */
398#define ALGORITHM_RIGHT_ASYMMETRIC 1 398#define ALGORITHM_RIGHT_ASYMMETRIC 1 /* Rotating Parity 0 with Data Restart */
399#define ALGORITHM_LEFT_SYMMETRIC 2 399#define ALGORITHM_LEFT_SYMMETRIC 2 /* Rotating Parity N with Data Continuation */
400#define ALGORITHM_RIGHT_SYMMETRIC 3 400#define ALGORITHM_RIGHT_SYMMETRIC 3 /* Rotating Parity 0 with Data Continuation */
401 401
402/* Define non-rotating (raid4) algorithms. These allow
403 * conversion of raid4 to raid5.
404 */
405#define ALGORITHM_PARITY_0 4 /* P or P,Q are initial devices */
406#define ALGORITHM_PARITY_N 5 /* P or P,Q are final devices. */
407
408/* DDF RAID6 layouts differ from md/raid6 layouts in two ways.
409 * Firstly, the exact positioning of the parity block is slightly
410 * different between the 'LEFT_*' modes of md and the "_N_*" modes
411 * of DDF.
412 * Secondly, or order of datablocks over which the Q syndrome is computed
413 * is different.
414 * Consequently we have different layouts for DDF/raid6 than md/raid6.
415 * These layouts are from the DDFv1.2 spec.
416 * Interestingly DDFv1.2-Errata-A does not specify N_CONTINUE but
417 * leaves RLQ=3 as 'Vendor Specific'
418 */
419
420#define ALGORITHM_ROTATING_ZERO_RESTART 8 /* DDF PRL=6 RLQ=1 */
421#define ALGORITHM_ROTATING_N_RESTART 9 /* DDF PRL=6 RLQ=2 */
422#define ALGORITHM_ROTATING_N_CONTINUE 10 /*DDF PRL=6 RLQ=3 */
423
424
425/* For every RAID5 algorithm we define a RAID6 algorithm
426 * with exactly the same layout for data and parity, and
427 * with the Q block always on the last device (N-1).
428 * This allows trivial conversion from RAID5 to RAID6
429 */
430#define ALGORITHM_LEFT_ASYMMETRIC_6 16
431#define ALGORITHM_RIGHT_ASYMMETRIC_6 17
432#define ALGORITHM_LEFT_SYMMETRIC_6 18
433#define ALGORITHM_RIGHT_SYMMETRIC_6 19
434#define ALGORITHM_PARITY_0_6 20
435#define ALGORITHM_PARITY_N_6 ALGORITHM_PARITY_N
436
437static inline int algorithm_valid_raid5(int layout)
438{
439 return (layout >= 0) &&
440 (layout <= 5);
441}
442static inline int algorithm_valid_raid6(int layout)
443{
444 return (layout >= 0 && layout <= 5)
445 ||
446 (layout == 8 || layout == 10)
447 ||
448 (layout >= 16 && layout <= 20);
449}
450
451static inline int algorithm_is_DDF(int layout)
452{
453 return layout >= 8 && layout <= 10;
454}
402#endif 455#endif