Date: Wed, 23 Mar 2011 16:58:04 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r219921 - projects/graid/head/sys/geom/raid Message-ID: <201103231658.p2NGw4W9001258@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Mar 23 16:58:04 2011 New Revision: 219921 URL: http://svn.freebsd.org/changeset/base/219921 Log: - Use RAID10 and RAID01 names more carefully. Even if they are very alike, they suppose different disk order (aabb vs abab). - Fix RAID01 disk order for NVidia. Modified: projects/graid/head/sys/geom/raid/md_nvidia.c projects/graid/head/sys/geom/raid/md_promise.c projects/graid/head/sys/geom/raid/md_sii.c Modified: projects/graid/head/sys/geom/raid/md_nvidia.c ============================================================================== --- projects/graid/head/sys/geom/raid/md_nvidia.c Wed Mar 23 16:38:29 2011 (r219920) +++ projects/graid/head/sys/geom/raid/md_nvidia.c Wed Mar 23 16:58:04 2011 (r219921) @@ -78,7 +78,8 @@ struct nvidia_raid_conf { #define NVIDIA_T_RAID3 0x0083 #define NVIDIA_T_RAID5 0x0085 /* RLQ = 00/02? */ #define NVIDIA_T_RAID5_SYM 0x0095 /* RLQ = 03 */ -#define NVIDIA_T_RAID10 0x8180 +#define NVIDIA_T_RAID10 0x008a +#define NVIDIA_T_RAID01 0x8180 #define NVIDIA_T_CONCAT 0x00ff uint16_t dummy_3; @@ -199,6 +200,19 @@ nvidia_meta_copy(struct nvidia_raid_conf return (nmeta); } +static int +nvidia_meta_translate_disk(struct nvidia_raid_conf *meta, int md_disk_pos) +{ + int disk_pos; + + if (md_disk_pos >= 0 && meta->type == NVIDIA_T_RAID01) { + disk_pos = (md_disk_pos / meta->array_width) + + (md_disk_pos % meta->array_width) * meta->array_width; + } else + disk_pos = md_disk_pos; + return (disk_pos); +} + static void nvidia_meta_get_name(struct nvidia_raid_conf *meta, char *buf) { @@ -279,7 +293,7 @@ nvidia_meta_read(struct g_consumer *cp) if (meta->type != NVIDIA_T_RAID0 && meta->type != NVIDIA_T_RAID1 && meta->type != NVIDIA_T_RAID3 && meta->type != NVIDIA_T_RAID5 && meta->type != NVIDIA_T_RAID5_SYM && - meta->type != NVIDIA_T_RAID10 && meta->type != NVIDIA_T_CONCAT) { + meta->type != NVIDIA_T_RAID01 && meta->type != NVIDIA_T_CONCAT) { G_RAID_DEBUG(1, "NVidia unknown RAID level on %s (0x%02x)", pp->name, meta->type); free(meta, M_MD_NVIDIA); @@ -426,6 +440,8 @@ g_raid_md_nvidia_start_disk(struct g_rai disk_pos = -3; } else disk_pos = -3; + /* For RAID0+1 we need to translate order. */ + disk_pos = nvidia_meta_translate_disk(meta, disk_pos); if (disk_pos < 0) { G_RAID_DEBUG1(1, sc, "Unknown, probably new or stale disk"); /* If we are in the start process, that's all for now. */ @@ -654,7 +670,7 @@ g_raid_md_nvidia_start(struct g_raid_sof } else if (meta->type == NVIDIA_T_RAID1) { vol->v_raid_level = G_RAID_VOLUME_RL_RAID1; size = vol->v_mediasize; - } else if (meta->type == NVIDIA_T_RAID10) { + } else if (meta->type == NVIDIA_T_RAID01) { vol->v_raid_level = G_RAID_VOLUME_RL_RAID1E; size = vol->v_mediasize / (mdi->mdio_total_disks / 2); } else if (meta->type == NVIDIA_T_CONCAT) { @@ -1441,7 +1457,7 @@ g_raid_md_write_nvidia(struct g_raid_md_ else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1) meta->type = NVIDIA_T_RAID1; else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1E) - meta->type = NVIDIA_T_RAID10; + meta->type = NVIDIA_T_RAID01; else if (vol->v_raid_level == G_RAID_VOLUME_RL_CONCAT || vol->v_raid_level == G_RAID_VOLUME_RL_SINGLE) meta->type = NVIDIA_T_CONCAT; @@ -1488,7 +1504,9 @@ g_raid_md_write_nvidia(struct g_raid_md_ } pd->pd_meta = nvidia_meta_copy(meta); if ((sd = TAILQ_FIRST(&disk->d_subdisks)) != NULL) { - pd->pd_meta->disk_number = sd->sd_pos; + /* For RAID0+1 we need to translate order. */ + pd->pd_meta->disk_number = + nvidia_meta_translate_disk(meta, sd->sd_pos); if (sd->sd_state != G_RAID_SUBDISK_S_ACTIVE) { pd->pd_meta->disk_status = 0x100; pd->pd_meta->rebuild_lba = Modified: projects/graid/head/sys/geom/raid/md_promise.c ============================================================================== --- projects/graid/head/sys/geom/raid/md_promise.c Wed Mar 23 16:38:29 2011 (r219920) +++ projects/graid/head/sys/geom/raid/md_promise.c Wed Mar 23 16:58:04 2011 (r219921) @@ -623,7 +623,7 @@ g_raid_md_promise_start_disk(struct g_ra if (sdn >= 0) { /* Find disk position in metadata by it's serial. */ md_disk_pos = promise_meta_find_disk(meta, pd->pd_meta[sdn]->disk.id); - /* For RAID10 we need to translate order. */ + /* For RAID0+1 we need to translate order. */ disk_pos = promise_meta_translate_disk(vol, md_disk_pos); } else { md_disk_pos = -1; @@ -684,7 +684,7 @@ g_raid_md_promise_start_disk(struct g_ra if (disk_pos >= 0) { if (vol->v_raid_level != G_RAID_VOLUME_RL_CONCAT) esize = size / 512; - /* For RAID10 we need to translate order. */ + /* For RAID0+1 we need to translate order. */ md_disk_pos = promise_meta_translate_disk(vol, disk_pos); } else { nofit: @@ -1725,7 +1725,7 @@ g_raid_md_write_promise(struct g_raid_md rebuild = 0; for (i = 0; i < vol->v_disks_count; i++) { sd = &vol->v_subdisks[i]; - /* For RAID10 we need to translate order. */ + /* For RAID0+1 we need to translate order. */ pos = promise_meta_translate_disk(vol, i); meta->disks[pos].flags = PROMISE_F_VALID | PROMISE_F_ASSIGNED; @@ -1795,7 +1795,7 @@ g_raid_md_write_promise(struct g_raid_md disk = sd->sd_disk; if (disk == NULL) continue; - /* For RAID10 we need to translate order. */ + /* For RAID0+1 we need to translate order. */ pos = promise_meta_translate_disk(vol, i); pd = (struct g_raid_md_promise_perdisk *)disk->d_md_data; for (j = 0; j < pd->pd_subdisks; j++) { Modified: projects/graid/head/sys/geom/raid/md_sii.c ============================================================================== --- projects/graid/head/sys/geom/raid/md_sii.c Wed Mar 23 16:38:29 2011 (r219920) +++ projects/graid/head/sys/geom/raid/md_sii.c Wed Mar 23 16:58:04 2011 (r219921) @@ -59,7 +59,7 @@ struct sii_raid_conf { uint8_t type; #define SII_T_RAID0 0x00 #define SII_T_RAID1 0x01 -#define SII_T_RAID10 0x02 +#define SII_T_RAID01 0x02 #define SII_T_SPARE 0x03 #define SII_T_CONCAT 0x04 #define SII_T_RAID5 0x10 @@ -200,7 +200,7 @@ sii_meta_total_disks(struct sii_raid_con return (meta->raid0_disks); case SII_T_RAID1: return (meta->raid1_disks); - case SII_T_RAID10: + case SII_T_RAID01: return (meta->raid0_disks * meta->raid1_disks); case SII_T_SPARE: case SII_T_JBOD: @@ -225,7 +225,7 @@ sii_meta_disk_pos(struct sii_raid_conf * case SII_T_RAID5: case SII_T_CONCAT: return (pdmeta->disk_number); - case SII_T_RAID10: + case SII_T_RAID01: return (pdmeta->raid1_ident * pdmeta->raid1_disks + pdmeta->raid0_ident); case SII_T_JBOD: @@ -306,7 +306,7 @@ sii_meta_read(struct g_consumer *cp) /* Check raid type. */ if (meta->type != SII_T_RAID0 && meta->type != SII_T_RAID1 && - meta->type != SII_T_RAID10 && meta->type != SII_T_SPARE && + meta->type != SII_T_RAID01 && meta->type != SII_T_SPARE && meta->type != SII_T_RAID5 && meta->type != SII_T_CONCAT && meta->type != SII_T_JBOD) { G_RAID_DEBUG(1, "SiI unknown RAID level on %s (0x%02x)", @@ -729,7 +729,7 @@ g_raid_md_sii_start(struct g_raid_softc } else if (meta->type == SII_T_RAID1) { vol->v_raid_level = G_RAID_VOLUME_RL_RAID1; size = vol->v_mediasize; - } else if (meta->type == SII_T_RAID10) { + } else if (meta->type == SII_T_RAID01) { vol->v_raid_level = G_RAID_VOLUME_RL_RAID1E; size = vol->v_mediasize / (mdi->mdio_total_disks / 2); } else if (meta->type == SII_T_CONCAT) { @@ -1533,7 +1533,7 @@ g_raid_md_write_sii(struct g_raid_md_obj meta->raid0_disks = 0xff; meta->raid1_disks = vol->v_disks_count; } else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1E) { - meta->type = SII_T_RAID10; + meta->type = SII_T_RAID01; meta->raid0_disks = vol->v_disks_count / 2; meta->raid1_disks = 2; } else if (vol->v_raid_level == G_RAID_VOLUME_RL_CONCAT ||
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103231658.p2NGw4W9001258>