Index: sys/dev/md/md.c =================================================================== --- sys/dev/md/md.c +++ sys/dev/md/md.c @@ -207,6 +207,7 @@ unsigned opencount; unsigned fwheads; unsigned fwsectors; + char ident[32]; unsigned flags; char name[20]; struct proc *procp; @@ -1178,6 +1179,8 @@ sc->fwheads))) || g_handleattr_int(bp, "GEOM::candelete", 1)) error = -1; + else if (g_handleattr_str(bp, "GEOM::ident", sc->ident)) + error = -1; else if (g_handleattr_int(bp, "MNT::verified", isv)) error = -1; else @@ -1294,6 +1297,7 @@ sc->fwsectors = mdio->md_fwsectors; if (mdio->md_fwheads != 0) sc->fwheads = mdio->md_fwheads; + snprintf(sc->ident, sizeof(sc->ident), "MD-%u", arc4random()); sc->flags = mdio->md_options & (MD_COMPRESS | MD_FORCE); sc->indir = dimension(sc->mediasize / sc->sectorsize); sc->uma = uma_zcreate(sc->name, sc->sectorsize, NULL, NULL, NULL, NULL, @@ -1411,6 +1415,8 @@ sc->fwsectors = mdio->md_fwsectors; if (mdio->md_fwheads != 0) sc->fwheads = mdio->md_fwheads; + snprintf(sc->ident, sizeof(sc->ident), "MD-DEV%lu-INO%lu", + vattr.va_fsid, vattr.va_fileid); sc->flags = mdio->md_options & (MD_FORCE | MD_ASYNC | MD_VERIFY); if (!(flags & FWRITE)) sc->flags |= MD_READONLY; @@ -1561,6 +1567,7 @@ sc->fwsectors = mdio->md_fwsectors; if (mdio->md_fwheads != 0) sc->fwheads = mdio->md_fwheads; + snprintf(sc->ident, sizeof(sc->ident), "MD-%u", arc4random()); sc->object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * npage, VM_PROT_DEFAULT, 0, td->td_ucred); if (sc->object == NULL) @@ -1592,6 +1599,8 @@ if (sc->mediasize <= 0 || (sc->mediasize % PAGE_SIZE) != 0) return (EDOM); + snprintf(sc->ident, sizeof(sc->ident), "MD-NULL"); + return (0); } @@ -1895,6 +1904,9 @@ indent, (uintmax_t) mp->fwheads); sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t) mp->fwsectors); + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", mp->ident); + sbuf_printf(sb, "\n"); sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t) mp->mediasize); sbuf_printf(sb, "%s%s\n", indent,