diff options
author | mav <mav@FreeBSD.org> | 2012-04-23 13:04:02 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2012-04-23 13:04:02 +0000 |
commit | 2e83ed7d1307db3a45a6e36835ccaf391564892f (patch) | |
tree | 2ccb5f571dfe86c293a964b635f01da4d29c34b7 | |
parent | c283985a30228d16a933ebadb71100f65caede2a (diff) | |
download | FreeBSD-src-2e83ed7d1307db3a45a6e36835ccaf391564892f.zip FreeBSD-src-2e83ed7d1307db3a45a6e36835ccaf391564892f.tar.gz |
Add names for all primary RAID levels defined by DDF 2.0 specification.
-rw-r--r-- | sys/geom/raid/g_raid.c | 164 | ||||
-rw-r--r-- | sys/geom/raid/g_raid.h | 30 | ||||
-rw-r--r-- | sys/geom/raid/tr_raid1.c | 3 | ||||
-rw-r--r-- | sys/geom/raid/tr_raid1e.c | 2 |
4 files changed, 180 insertions, 19 deletions
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c index 4a509e8..5d02023 100644 --- a/sys/geom/raid/g_raid.c +++ b/sys/geom/raid/g_raid.c @@ -277,31 +277,87 @@ g_raid_volume_level2str(int level, int qual) case G_RAID_VOLUME_RL_RAID1: return ("RAID1"); case G_RAID_VOLUME_RL_RAID3: + if (qual == G_RAID_VOLUME_RLQ_R3P0) + return ("RAID3-P0"); + if (qual == G_RAID_VOLUME_RLQ_R3PN) + return ("RAID3-PN"); return ("RAID3"); case G_RAID_VOLUME_RL_RAID4: + if (qual == G_RAID_VOLUME_RLQ_R4P0) + return ("RAID3-P0"); + if (qual == G_RAID_VOLUME_RLQ_R4PN) + return ("RAID3-PN"); return ("RAID4"); case G_RAID_VOLUME_RL_RAID5: if (qual == G_RAID_VOLUME_RLQ_R5RA) - return ("RAID5RA"); + return ("RAID5-RA"); if (qual == G_RAID_VOLUME_RLQ_R5RS) - return ("RAID5RS"); + return ("RAID5-RS"); if (qual == G_RAID_VOLUME_RLQ_R5LA) - return ("RAID5LA"); + return ("RAID5-LA"); if (qual == G_RAID_VOLUME_RLQ_R5LS) - return ("RAID5LS"); + return ("RAID5-LS"); return ("RAID5"); case G_RAID_VOLUME_RL_RAID6: + if (qual == G_RAID_VOLUME_RLQ_R6RA) + return ("RAID6-RA"); + if (qual == G_RAID_VOLUME_RLQ_R6RS) + return ("RAID6-RS"); + if (qual == G_RAID_VOLUME_RLQ_R6LA) + return ("RAID6-LA"); + if (qual == G_RAID_VOLUME_RLQ_R6LS) + return ("RAID6-LS"); return ("RAID6"); + case G_RAID_VOLUME_RL_RAIDMDF: + if (qual == G_RAID_VOLUME_RLQ_RMDFRA) + return ("RAIDMDF-RA"); + if (qual == G_RAID_VOLUME_RLQ_RMDFRS) + return ("RAIDMDF-RS"); + if (qual == G_RAID_VOLUME_RLQ_RMDFLA) + return ("RAIDMDF-LA"); + if (qual == G_RAID_VOLUME_RLQ_RMDFLS) + return ("RAIDMDF-LS"); + return ("RAIDMDF"); case G_RAID_VOLUME_RL_RAID1E: + if (qual == G_RAID_VOLUME_RLQ_R1EA) + return ("RAID1E-A"); + if (qual == G_RAID_VOLUME_RLQ_R1EO) + return ("RAID1E-O"); return ("RAID1E"); case G_RAID_VOLUME_RL_SINGLE: return ("SINGLE"); case G_RAID_VOLUME_RL_CONCAT: return ("CONCAT"); case G_RAID_VOLUME_RL_RAID5E: + if (qual == G_RAID_VOLUME_RLQ_R5ERA) + return ("RAID5E-RA"); + if (qual == G_RAID_VOLUME_RLQ_R5ERS) + return ("RAID5E-RS"); + if (qual == G_RAID_VOLUME_RLQ_R5ELA) + return ("RAID5E-LA"); + if (qual == G_RAID_VOLUME_RLQ_R5ELS) + return ("RAID5E-LS"); return ("RAID5E"); case G_RAID_VOLUME_RL_RAID5EE: + if (qual == G_RAID_VOLUME_RLQ_R5EERA) + return ("RAID5EE-RA"); + if (qual == G_RAID_VOLUME_RLQ_R5EERS) + return ("RAID5EE-RS"); + if (qual == G_RAID_VOLUME_RLQ_R5EELA) + return ("RAID5EE-LA"); + if (qual == G_RAID_VOLUME_RLQ_R5EELS) + return ("RAID5EE-LS"); return ("RAID5EE"); + case G_RAID_VOLUME_RL_RAID5R: + if (qual == G_RAID_VOLUME_RLQ_R5RRA) + return ("RAID5R-RA"); + if (qual == G_RAID_VOLUME_RLQ_R5RRS) + return ("RAID5R-RS"); + if (qual == G_RAID_VOLUME_RLQ_R5RLA) + return ("RAID5R-LA"); + if (qual == G_RAID_VOLUME_RLQ_R5RLS) + return ("RAID5R-LS"); + return ("RAID5E"); default: return ("UNKNOWN"); } @@ -317,37 +373,111 @@ g_raid_volume_str2level(const char *str, int *level, int *qual) *level = G_RAID_VOLUME_RL_RAID0; else if (strcasecmp(str, "RAID1") == 0) *level = G_RAID_VOLUME_RL_RAID1; - else if (strcasecmp(str, "RAID3") == 0) + else if (strcasecmp(str, "RAID3-P0") == 0) { + *level = G_RAID_VOLUME_RL_RAID3; + *qual = G_RAID_VOLUME_RLQ_R3P0; + } else if (strcasecmp(str, "RAID3-PN") == 0 && + strcasecmp(str, "RAID3") == 0) { *level = G_RAID_VOLUME_RL_RAID3; - else if (strcasecmp(str, "RAID4") == 0) + *qual = G_RAID_VOLUME_RLQ_R3P0; + } else if (strcasecmp(str, "RAID4-P0") == 0) { *level = G_RAID_VOLUME_RL_RAID4; - else if (strcasecmp(str, "RAID5RA") == 0) { + *qual = G_RAID_VOLUME_RLQ_R4P0; + } else if (strcasecmp(str, "RAID4-PN") == 0 && + strcasecmp(str, "RAID4") == 0) { + *level = G_RAID_VOLUME_RL_RAID4; + *qual = G_RAID_VOLUME_RLQ_R4P0; + } else if (strcasecmp(str, "RAID5-RA") == 0) { *level = G_RAID_VOLUME_RL_RAID5; *qual = G_RAID_VOLUME_RLQ_R5RA; - } else if (strcasecmp(str, "RAID5RS") == 0) { + } else if (strcasecmp(str, "RAID5-RS") == 0) { *level = G_RAID_VOLUME_RL_RAID5; *qual = G_RAID_VOLUME_RLQ_R5RS; } else if (strcasecmp(str, "RAID5") == 0 || - strcasecmp(str, "RAID5LA") == 0) { + strcasecmp(str, "RAID5-LA") == 0) { *level = G_RAID_VOLUME_RL_RAID5; *qual = G_RAID_VOLUME_RLQ_R5LA; - } else if (strcasecmp(str, "RAID5LS") == 0) { + } else if (strcasecmp(str, "RAID5-LS") == 0) { *level = G_RAID_VOLUME_RL_RAID5; *qual = G_RAID_VOLUME_RLQ_R5LS; - } else if (strcasecmp(str, "RAID6") == 0) + } else if (strcasecmp(str, "RAID6-RA") == 0) { + *level = G_RAID_VOLUME_RL_RAID6; + *qual = G_RAID_VOLUME_RLQ_R6RA; + } else if (strcasecmp(str, "RAID6-RS") == 0) { *level = G_RAID_VOLUME_RL_RAID6; - else if (strcasecmp(str, "RAID10") == 0 || - strcasecmp(str, "RAID1E") == 0) + *qual = G_RAID_VOLUME_RLQ_R6RS; + } else if (strcasecmp(str, "RAID6") == 0 || + strcasecmp(str, "RAID6-LA") == 0) { + *level = G_RAID_VOLUME_RL_RAID6; + *qual = G_RAID_VOLUME_RLQ_R6LA; + } else if (strcasecmp(str, "RAID6-LS") == 0) { + *level = G_RAID_VOLUME_RL_RAID6; + *qual = G_RAID_VOLUME_RLQ_R6LS; + } else if (strcasecmp(str, "RAIDMDF-RA") == 0) { + *level = G_RAID_VOLUME_RL_RAIDMDF; + *qual = G_RAID_VOLUME_RLQ_RMDFRA; + } else if (strcasecmp(str, "RAIDMDF-RS") == 0) { + *level = G_RAID_VOLUME_RL_RAIDMDF; + *qual = G_RAID_VOLUME_RLQ_RMDFRS; + } else if (strcasecmp(str, "RAIDMDF") == 0 || + strcasecmp(str, "RAIDMDF-LA") == 0) { + *level = G_RAID_VOLUME_RL_RAIDMDF; + *qual = G_RAID_VOLUME_RLQ_RMDFLA; + } else if (strcasecmp(str, "RAIDMDF-LS") == 0) { + *level = G_RAID_VOLUME_RL_RAIDMDF; + *qual = G_RAID_VOLUME_RLQ_RMDFLS; + } else if (strcasecmp(str, "RAID10") == 0 || + strcasecmp(str, "RAID1E") == 0 || + strcasecmp(str, "RAID1E-A") == 0) { *level = G_RAID_VOLUME_RL_RAID1E; - else if (strcasecmp(str, "SINGLE") == 0) + *qual = G_RAID_VOLUME_RLQ_R1EA; + } else if (strcasecmp(str, "RAID1E-O") == 0) { + *level = G_RAID_VOLUME_RL_RAID1E; + *qual = G_RAID_VOLUME_RLQ_R1EO; + } else if (strcasecmp(str, "SINGLE") == 0) *level = G_RAID_VOLUME_RL_SINGLE; else if (strcasecmp(str, "CONCAT") == 0) *level = G_RAID_VOLUME_RL_CONCAT; - else if (strcasecmp(str, "RAID5E") == 0) + else if (strcasecmp(str, "RAID5E-RA") == 0) { + *level = G_RAID_VOLUME_RL_RAID5E; + *qual = G_RAID_VOLUME_RLQ_R5ERA; + } else if (strcasecmp(str, "RAID5E-RS") == 0) { *level = G_RAID_VOLUME_RL_RAID5E; - else if (strcasecmp(str, "RAID5EE") == 0) + *qual = G_RAID_VOLUME_RLQ_R5ERS; + } else if (strcasecmp(str, "RAID5E") == 0 || + strcasecmp(str, "RAID5E-LA") == 0) { + *level = G_RAID_VOLUME_RL_RAID5E; + *qual = G_RAID_VOLUME_RLQ_R5ELA; + } else if (strcasecmp(str, "RAID5E-LS") == 0) { + *level = G_RAID_VOLUME_RL_RAID5E; + *qual = G_RAID_VOLUME_RLQ_R5ELS; + } else if (strcasecmp(str, "RAID5EE-RA") == 0) { *level = G_RAID_VOLUME_RL_RAID5EE; - else + *qual = G_RAID_VOLUME_RLQ_R5EERA; + } else if (strcasecmp(str, "RAID5EE-RS") == 0) { + *level = G_RAID_VOLUME_RL_RAID5EE; + *qual = G_RAID_VOLUME_RLQ_R5EERS; + } else if (strcasecmp(str, "RAID5EE") == 0 || + strcasecmp(str, "RAID5EE-LA") == 0) { + *level = G_RAID_VOLUME_RL_RAID5EE; + *qual = G_RAID_VOLUME_RLQ_R5EELA; + } else if (strcasecmp(str, "RAID5EE-LS") == 0) { + *level = G_RAID_VOLUME_RL_RAID5EE; + *qual = G_RAID_VOLUME_RLQ_R5EELS; + } else if (strcasecmp(str, "RAID5R-RA") == 0) { + *level = G_RAID_VOLUME_RL_RAID5R; + *qual = G_RAID_VOLUME_RLQ_R5RRA; + } else if (strcasecmp(str, "RAID5R-RS") == 0) { + *level = G_RAID_VOLUME_RL_RAID5R; + *qual = G_RAID_VOLUME_RLQ_R5RRS; + } else if (strcasecmp(str, "RAID5R") == 0 || + strcasecmp(str, "RAID5R-LA") == 0) { + *level = G_RAID_VOLUME_RL_RAID5R; + *qual = G_RAID_VOLUME_RLQ_R5RLA; + } else if (strcasecmp(str, "RAID5R-LS") == 0) { + *level = G_RAID_VOLUME_RL_RAID5R; + *qual = G_RAID_VOLUME_RLQ_R5RLS; + } else return (-1); return (0); } diff --git a/sys/geom/raid/g_raid.h b/sys/geom/raid/g_raid.h index 6b67e8c..1572320 100644 --- a/sys/geom/raid/g_raid.h +++ b/sys/geom/raid/g_raid.h @@ -219,18 +219,48 @@ struct g_raid_subdisk { #define G_RAID_VOLUME_RL_RAID4 0x04 #define G_RAID_VOLUME_RL_RAID5 0x05 #define G_RAID_VOLUME_RL_RAID6 0x06 +#define G_RAID_VOLUME_RL_RAIDMDF 0x07 #define G_RAID_VOLUME_RL_RAID1E 0x11 #define G_RAID_VOLUME_RL_SINGLE 0x0f #define G_RAID_VOLUME_RL_CONCAT 0x1f #define G_RAID_VOLUME_RL_RAID5E 0x15 #define G_RAID_VOLUME_RL_RAID5EE 0x25 +#define G_RAID_VOLUME_RL_RAID5R 0x35 #define G_RAID_VOLUME_RL_UNKNOWN 0xff #define G_RAID_VOLUME_RLQ_NONE 0x00 +#define G_RAID_VOLUME_RLQ_R1SM 0x00 +#define G_RAID_VOLUME_RLQ_R1MM 0x01 +#define G_RAID_VOLUME_RLQ_R3P0 0x00 +#define G_RAID_VOLUME_RLQ_R3PN 0x01 +#define G_RAID_VOLUME_RLQ_R4P0 0x00 +#define G_RAID_VOLUME_RLQ_R4PN 0x01 #define G_RAID_VOLUME_RLQ_R5RA 0x00 #define G_RAID_VOLUME_RLQ_R5RS 0x01 #define G_RAID_VOLUME_RLQ_R5LA 0x02 #define G_RAID_VOLUME_RLQ_R5LS 0x03 +#define G_RAID_VOLUME_RLQ_R6RA 0x00 +#define G_RAID_VOLUME_RLQ_R6RS 0x01 +#define G_RAID_VOLUME_RLQ_R6LA 0x02 +#define G_RAID_VOLUME_RLQ_R6LS 0x03 +#define G_RAID_VOLUME_RLQ_RMDFRA 0x00 +#define G_RAID_VOLUME_RLQ_RMDFRS 0x01 +#define G_RAID_VOLUME_RLQ_RMDFLA 0x02 +#define G_RAID_VOLUME_RLQ_RMDFLS 0x03 +#define G_RAID_VOLUME_RLQ_R1EA 0x00 +#define G_RAID_VOLUME_RLQ_R1EO 0x01 +#define G_RAID_VOLUME_RLQ_R5ERA 0x00 +#define G_RAID_VOLUME_RLQ_R5ERS 0x01 +#define G_RAID_VOLUME_RLQ_R5ELA 0x02 +#define G_RAID_VOLUME_RLQ_R5ELS 0x03 +#define G_RAID_VOLUME_RLQ_R5EERA 0x00 +#define G_RAID_VOLUME_RLQ_R5EERS 0x01 +#define G_RAID_VOLUME_RLQ_R5EELA 0x02 +#define G_RAID_VOLUME_RLQ_R5EELS 0x03 +#define G_RAID_VOLUME_RLQ_R5RRA 0x00 +#define G_RAID_VOLUME_RLQ_R5RRS 0x01 +#define G_RAID_VOLUME_RLQ_R5RLA 0x02 +#define G_RAID_VOLUME_RLQ_R5RLS 0x03 #define G_RAID_VOLUME_RLQ_UNKNOWN 0xff struct g_raid_volume; diff --git a/sys/geom/raid/tr_raid1.c b/sys/geom/raid/tr_raid1.c index 36b7f7b..ccd3157 100644 --- a/sys/geom/raid/tr_raid1.c +++ b/sys/geom/raid/tr_raid1.c @@ -145,7 +145,8 @@ g_raid_tr_taste_raid1(struct g_raid_tr_object *tr, struct g_raid_volume *vol) trs = (struct g_raid_tr_raid1_object *)tr; if (tr->tro_volume->v_raid_level != G_RAID_VOLUME_RL_RAID1 || - tr->tro_volume->v_raid_level_qualifier != G_RAID_VOLUME_RLQ_NONE) + (tr->tro_volume->v_raid_level_qualifier != G_RAID_VOLUME_RLQ_R1SM && + tr->tro_volume->v_raid_level_qualifier != G_RAID_VOLUME_RLQ_R1MM)) return (G_RAID_TR_TASTE_FAIL); trs->trso_starting = 1; return (G_RAID_TR_TASTE_SUCCEED); diff --git a/sys/geom/raid/tr_raid1e.c b/sys/geom/raid/tr_raid1e.c index c827117..141ff7a 100644 --- a/sys/geom/raid/tr_raid1e.c +++ b/sys/geom/raid/tr_raid1e.c @@ -187,7 +187,7 @@ g_raid_tr_taste_raid1e(struct g_raid_tr_object *tr, struct g_raid_volume *vol) trs = (struct g_raid_tr_raid1e_object *)tr; if (tr->tro_volume->v_raid_level != G_RAID_VOLUME_RL_RAID1E || - tr->tro_volume->v_raid_level_qualifier != G_RAID_VOLUME_RLQ_NONE) + tr->tro_volume->v_raid_level_qualifier != G_RAID_VOLUME_RLQ_R1EA) return (G_RAID_TR_TASTE_FAIL); trs->trso_starting = 1; return (G_RAID_TR_TASTE_SUCCEED); |