- Make kern.geom.mirror.debug and kern.geom.mirror.timeout sysctls tunable. - Don't handle spoiling for synchronization geom. - Skip providers with 0 sectorsize. - Some other fixes. diff -u ./g_mirror.c /sys/geom/mirror/g_mirror.c --- ./g_mirror.c Sun Aug 15 15:58:29 2004 +++ sys/geom/mirror/g_mirror.c Wed Sep 8 18:37:22 2004 @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.19 2004/08/15 13:58:29 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.26 2004/09/08 16:37:22 pjd Exp $"); #include #include @@ -51,9 +51,11 @@ SYSCTL_DECL(_kern_geom); SYSCTL_NODE(_kern_geom, OID_AUTO, mirror, CTLFLAG_RW, 0, "GEOM_MIRROR stuff"); u_int g_mirror_debug = 0; +TUNABLE_INT("kern.geom.mirror.debug", &g_mirror_debug); SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RW, &g_mirror_debug, 0, "Debug level"); static u_int g_mirror_timeout = 8; +TUNABLE_INT("kern.geom.mirror.timeout", &g_mirror_timeout); SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, timeout, CTLFLAG_RW, &g_mirror_timeout, 0, "Time to wait on all mirror components"); static u_int g_mirror_reqs_per_sync = 5; @@ -1898,18 +1900,12 @@ break; } case G_MIRROR_DEVICE_STATE_RUNNING: - /* - * Bump syncid here, if we need to do it immediately. - */ - if (sc->sc_bump_syncid == G_MIRROR_BUMP_IMMEDIATELY) { - sc->sc_bump_syncid = 0; - g_mirror_bump_syncid(sc); - } if (g_mirror_ndisks(sc, -1) == 0) { /* * No disks at all, we need to destroy device. */ sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY; + break; } else if (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) == 0 && g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_NEW) == 0) { @@ -1918,6 +1914,7 @@ */ if (sc->sc_provider != NULL) g_mirror_destroy_provider(sc); + break; } else if (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 0 && g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_NEW) == 0) { @@ -1928,6 +1925,13 @@ if (sc->sc_provider == NULL) g_mirror_launch_provider(sc); } + /* + * Bump syncid here, if we need to do it immediately. + */ + if (sc->sc_bump_syncid == G_MIRROR_BUMP_IMMEDIATELY) { + sc->sc_bump_syncid = 0; + g_mirror_bump_syncid(sc); + } break; default: KASSERT(1 == 0, ("Wrong device state (%s, %s).", @@ -2402,7 +2406,6 @@ */ gp = g_new_geomf(mp, "%s.sync", md->md_name); gp->softc = sc; - gp->spoiled = g_mirror_spoiled; gp->orphan = g_mirror_orphan; sc->sc_sync.ds_geom = gp; sc->sc_sync.ds_ndisks = 0; @@ -2488,6 +2491,9 @@ g_topology_assert(); g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); G_MIRROR_DEBUG(2, "Tasting %s.", pp->name); + /* Skip providers with 0 sectorsize. */ + if (pp->sectorsize == 0) + return (NULL); gp = g_new_geomf(mp, "mirror:taste"); /* @@ -2523,6 +2529,7 @@ /* * Let's check if device already exists. */ + sc = NULL; LIST_FOREACH(gp, &mp->geom, geom) { sc = gp->softc; if (sc == NULL) @@ -2659,6 +2666,15 @@ balance_name(sc->sc_balance)); sbuf_printf(sb, "%s%u\n", indent, sc->sc_ndisks); + sbuf_printf(sb, "%s", indent); + if (sc->sc_state == G_MIRROR_DEVICE_STATE_STARTING) + sbuf_printf(sb, "%s", "STARTING"); + else if (sc->sc_ndisks == + g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE)) + sbuf_printf(sb, "%s", "COMPLETE"); + else + sbuf_printf(sb, "%s", "DEGRADED"); + sbuf_printf(sb, "\n"); } }