geom_vinum_plex.c revision 135426
1/*- 2 * Copyright (c) 2004 Lukas Ertl 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> 28__FBSDID("$FreeBSD: head/sys/geom/vinum/geom_vinum_plex.c 135426 2004-09-18 13:44:43Z le $"); 29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/kernel.h> 33#include <sys/kthread.h> 34#include <sys/libkern.h> 35#include <sys/lock.h> 36#include <sys/malloc.h> 37#include <sys/module.h> 38#include <sys/mutex.h> 39#include <sys/systm.h> 40 41#include <geom/geom.h> 42#include <geom/vinum/geom_vinum_var.h> 43#include <geom/vinum/geom_vinum_raid5.h> 44#include <geom/vinum/geom_vinum.h> 45 46static void gv_plex_completed_request(struct gv_plex *, struct bio *); 47static void gv_plex_normal_request(struct gv_plex *, struct bio *); 48static void gv_plex_worker(void *); 49 50/* XXX: is this the place to catch dying subdisks? */ 51static void 52gv_plex_orphan(struct g_consumer *cp) 53{ 54 struct g_geom *gp; 55 struct gv_plex *p; 56 int error; 57 58 g_topology_assert(); 59 gp = cp->geom; 60 g_trace(G_T_TOPOLOGY, "gv_plex_orphan(%s)", gp->name); 61 62 if (cp->acr != 0 || cp->acw != 0 || cp->ace != 0) 63 g_access(cp, -cp->acr, -cp->acw, -cp->ace); 64 error = cp->provider->error; 65 if (error == 0) 66 error = ENXIO; 67 g_detach(cp); 68 g_destroy_consumer(cp); 69 if (!LIST_EMPTY(&gp->consumer)) 70 return; 71 72 p = gp->softc; 73 if (p != NULL) { 74 gv_kill_plex_thread(p); 75 p->geom = NULL; 76 p->provider = NULL; 77 p->consumer = NULL; 78 } 79 gp->softc = NULL; 80 g_wither_geom(gp, error); 81} 82 83void 84gv_plex_done(struct bio *bp) 85{ 86 struct gv_plex *p; 87 struct gv_bioq *bq; 88 89 p = bp->bio_from->geom->softc; 90 bp->bio_cflags |= GV_BIO_DONE; 91 bq = g_malloc(sizeof(*bq), M_NOWAIT | M_ZERO); 92 bq->bp = bp; 93 mtx_lock(&p->bqueue_mtx); 94 TAILQ_INSERT_TAIL(&p->bqueue, bq, queue); 95 wakeup(p); 96 mtx_unlock(&p->bqueue_mtx); 97} 98 99/* Find the correct subdisk to send the bio to and build a bio to send. */ 100static int 101gv_plexbuffer(struct gv_plex *p, struct bio *bp, caddr_t addr, off_t boff, off_t bcount) 102{ 103 struct g_geom *gp; 104 struct gv_sd *s; 105 struct bio *cbp, *pbp; 106 int i, sdno; 107 off_t len_left, real_len, real_off; 108 off_t stripeend, stripeno, stripestart; 109 110 if (p == NULL || LIST_EMPTY(&p->subdisks)) 111 return (ENXIO); 112 113 s = NULL; 114 gp = bp->bio_to->geom; 115 116 /* 117 * We only handle concatenated and striped plexes here. RAID5 plexes 118 * are handled in build_raid5_request(). 119 */ 120 switch (p->org) { 121 case GV_PLEX_CONCAT: 122 /* 123 * Find the subdisk where this request starts. The subdisks in 124 * this list must be ordered by plex_offset. 125 */ 126 LIST_FOREACH(s, &p->subdisks, in_plex) { 127 if (s->plex_offset <= boff && 128 s->plex_offset + s->size > boff) 129 break; 130 } 131 /* Subdisk not found. */ 132 if (s == NULL) 133 return (ENXIO); 134 135 /* Calculate corresponding offsets on disk. */ 136 real_off = boff - s->plex_offset; 137 len_left = s->size - real_off; 138 real_len = (bcount > len_left) ? len_left : bcount; 139 break; 140 141 case GV_PLEX_STRIPED: 142 /* The number of the stripe where the request starts. */ 143 stripeno = boff / p->stripesize; 144 145 /* The number of the subdisk where the stripe resides. */ 146 sdno = stripeno % p->sdcount; 147 148 /* Find the right subdisk. */ 149 i = 0; 150 LIST_FOREACH(s, &p->subdisks, in_plex) { 151 if (i == sdno) 152 break; 153 i++; 154 } 155 156 /* Subdisk not found. */ 157 if (s == NULL) 158 return (ENXIO); 159 160 /* The offset of the stripe from the start of the subdisk. */ 161 stripestart = (stripeno / p->sdcount) * 162 p->stripesize; 163 164 /* The offset at the end of the stripe. */ 165 stripeend = stripestart + p->stripesize; 166 167 /* The offset of the request on this subdisk. */ 168 real_off = boff - (stripeno * p->stripesize) + 169 stripestart; 170 171 /* The length left in this stripe. */ 172 len_left = stripeend - real_off; 173 174 real_len = (bcount <= len_left) ? bcount : len_left; 175 break; 176 177 default: 178 return (EINVAL); 179 } 180 181 /* Now check if we can handle the request on this subdisk. */ 182 switch (s->state) { 183 case GV_SD_UP: 184 /* If the subdisk is up, just continue. */ 185 break; 186 187 case GV_SD_STALE: 188 if (!(bp->bio_cflags & GV_BIO_SYNCREQ)) 189 return (ENXIO); 190 191 printf("GEOM_VINUM: sd %s is initializing\n", s->name); 192 gv_set_sd_state(s, GV_SD_INITIALIZING, GV_SETSTATE_FORCE); 193 break; 194 195 case GV_SD_INITIALIZING: 196 if (bp->bio_cmd == BIO_READ) 197 return (ENXIO); 198 break; 199 200 default: 201 /* All other subdisk states mean it's not accessible. */ 202 return (ENXIO); 203 } 204 205 /* Clone the bio and adjust the offsets and sizes. */ 206 cbp = g_clone_bio(bp); 207 if (cbp == NULL) 208 return (ENOMEM); 209 cbp->bio_offset = real_off; 210 cbp->bio_length = real_len; 211 cbp->bio_data = addr; 212 cbp->bio_done = g_std_done; 213 cbp->bio_caller2 = s->consumer; 214 if ((bp->bio_cflags & GV_BIO_SYNCREQ)) { 215 cbp->bio_cflags |= GV_BIO_SYNCREQ; 216 cbp->bio_done = gv_plex_done; 217 } 218 219 if (bp->bio_driver1 == NULL) { 220 bp->bio_driver1 = cbp; 221 } else { 222 pbp = bp->bio_driver1; 223 while (pbp->bio_caller1 != NULL) 224 pbp = pbp->bio_caller1; 225 pbp->bio_caller1 = cbp; 226 } 227 228 return (0); 229} 230 231static void 232gv_plex_start(struct bio *bp) 233{ 234 struct gv_plex *p; 235 struct gv_bioq *bq; 236 237 switch(bp->bio_cmd) { 238 case BIO_READ: 239 case BIO_WRITE: 240 case BIO_DELETE: 241 break; 242 case BIO_GETATTR: 243 default: 244 g_io_deliver(bp, EOPNOTSUPP); 245 return; 246 } 247 248 /* 249 * We cannot handle this request if too many of our subdisks are 250 * inaccessible. 251 */ 252 p = bp->bio_to->geom->softc; 253 if ((p->state < GV_PLEX_DEGRADED) && 254 !(bp->bio_cflags & GV_BIO_SYNCREQ)) { 255 g_io_deliver(bp, ENXIO); 256 return; 257 } 258 259 bq = g_malloc(sizeof(*bq), M_NOWAIT | M_ZERO); 260 bq->bp = bp; 261 mtx_lock(&p->bqueue_mtx); 262 TAILQ_INSERT_TAIL(&p->bqueue, bq, queue); 263 wakeup(p); 264 mtx_unlock(&p->bqueue_mtx); 265} 266 267static void 268gv_plex_worker(void *arg) 269{ 270 struct bio *bp; 271 struct gv_plex *p; 272 struct gv_sd *s; 273 struct gv_bioq *bq; 274 275 p = arg; 276 KASSERT(p != NULL, ("NULL p")); 277 278 mtx_lock(&p->bqueue_mtx); 279 for (;;) { 280 /* We were signaled to exit. */ 281 if (p->flags & GV_PLEX_THREAD_DIE) 282 break; 283 284 /* Take the first BIO from our queue. */ 285 bq = TAILQ_FIRST(&p->bqueue); 286 if (bq == NULL) { 287 msleep(p, &p->bqueue_mtx, PRIBIO, "-", hz/10); 288 continue; 289 } 290 TAILQ_REMOVE(&p->bqueue, bq, queue); 291 mtx_unlock(&p->bqueue_mtx); 292 293 bp = bq->bp; 294 295 /* A completed request. */ 296 if (bp->bio_cflags & GV_BIO_DONE) { 297 g_free(bq); 298 if (bp->bio_cflags & GV_BIO_SYNCREQ) { 299 s = bp->bio_to->private; 300 if (bp->bio_error == 0) 301 s->initialized += bp->bio_length; 302 if (s->initialized >= s->size) { 303 g_topology_lock(); 304 gv_set_sd_state(s, GV_SD_UP, 305 GV_SETSTATE_CONFIG); 306 g_topology_unlock(); 307 s->initialized = 0; 308 } 309 g_std_done(bp); 310 } else 311 gv_plex_completed_request(p, bp); 312 /* 313 * A sub-request that was hold back because it interfered with 314 * another sub-request. 315 */ 316 } else if (bp->bio_cflags & GV_BIO_ONHOLD) { 317 /* Is it still locked out? */ 318 if (gv_stripe_active(p, bp)) { 319 mtx_lock(&p->bqueue_mtx); 320 TAILQ_INSERT_TAIL(&p->bqueue, bq, queue); 321 mtx_unlock(&p->bqueue_mtx); 322 } else { 323 g_free(bq); 324 bp->bio_cflags &= ~GV_BIO_ONHOLD; 325 g_io_request(bp, bp->bio_caller2); 326 } 327 328 /* A normal request to this plex. */ 329 } else { 330 g_free(bq); 331 gv_plex_normal_request(p, bp); 332 } 333 334 mtx_lock(&p->bqueue_mtx); 335 } 336 mtx_unlock(&p->bqueue_mtx); 337 p->flags |= GV_PLEX_THREAD_DEAD; 338 wakeup(p); 339 340 kthread_exit(ENXIO); 341} 342 343void 344gv_plex_completed_request(struct gv_plex *p, struct bio *bp) 345{ 346 struct bio *cbp, *pbp; 347 struct gv_bioq *bq, *bq2; 348 struct gv_raid5_packet *wp; 349 int i; 350 351 wp = bp->bio_driver1; 352 353 switch (bp->bio_parent->bio_cmd) { 354 case BIO_READ: 355 if (wp == NULL) 356 break; 357 358 TAILQ_FOREACH_SAFE(bq, &wp->bits, queue, bq2) { 359 if (bq->bp == bp) { 360 TAILQ_REMOVE(&wp->bits, bq, queue); 361 g_free(bq); 362 for (i = 0; i < wp->length; i++) 363 wp->data[i] ^= bp->bio_data[i]; 364 break; 365 } 366 } 367 if (TAILQ_EMPTY(&wp->bits)) { 368 bp->bio_parent->bio_completed += wp->length; 369 if (wp->lockbase != -1) 370 TAILQ_REMOVE(&p->packets, wp, list); 371 g_free(wp); 372 } 373 374 break; 375 376 case BIO_WRITE: 377 if (wp == NULL) 378 break; 379 380 /* Check if we need to handle parity data. */ 381 TAILQ_FOREACH_SAFE(bq, &wp->bits, queue, bq2) { 382 if (bq->bp == bp) { 383 TAILQ_REMOVE(&wp->bits, bq, queue); 384 g_free(bq); 385 cbp = wp->parity; 386 if (cbp != NULL) { 387 for (i = 0; i < wp->length; i++) 388 cbp->bio_data[i] ^= 389 bp->bio_data[i]; 390 } 391 break; 392 } 393 } 394 395 /* Handle parity data. */ 396 if (TAILQ_EMPTY(&wp->bits)) { 397 if (wp->waiting != NULL) { 398 pbp = wp->waiting; 399 wp->waiting = NULL; 400 cbp = wp->parity; 401 for (i = 0; i < wp->length; i++) 402 cbp->bio_data[i] ^= pbp->bio_data[i]; 403 g_io_request(pbp, pbp->bio_caller2); 404 } else if (wp->parity != NULL) { 405 cbp = wp->parity; 406 wp->parity = NULL; 407 g_io_request(cbp, cbp->bio_caller2); 408 } else { 409 bp->bio_parent->bio_completed += wp->length; 410 TAILQ_REMOVE(&p->packets, wp, list); 411 g_free(wp); 412 } 413 } 414 415 break; 416 } 417 418 pbp = bp->bio_parent; 419 if (pbp->bio_error == 0) 420 pbp->bio_error = bp->bio_error; 421 422 /* When the original request is finished, we deliver it. */ 423 pbp->bio_inbed++; 424 if (pbp->bio_inbed == pbp->bio_children) 425 g_io_deliver(pbp, pbp->bio_error); 426 427 /* Clean up what we allocated. */ 428 if (bp->bio_cflags & GV_BIO_MALLOC) 429 g_free(bp->bio_data); 430 g_destroy_bio(bp); 431} 432 433void 434gv_plex_normal_request(struct gv_plex *p, struct bio *bp) 435{ 436 struct bio *cbp, *pbp; 437 struct gv_bioq *bq, *bq2; 438 struct gv_raid5_packet *wp, *wp2; 439 caddr_t addr; 440 off_t bcount, boff; 441 int err; 442 443 bcount = bp->bio_length; 444 addr = bp->bio_data; 445 boff = bp->bio_offset; 446 447 /* Walk over the whole length of the request, we might split it up. */ 448 while (bcount > 0) { 449 wp = NULL; 450 451 /* 452 * RAID5 plexes need special treatment, as a single write 453 * request involves several read/write sub-requests. 454 */ 455 if (p->org == GV_PLEX_RAID5) { 456 wp = g_malloc(sizeof(*wp), M_WAITOK | M_ZERO); 457 wp->bio = bp; 458 TAILQ_INIT(&wp->bits); 459 460 err = gv_build_raid5_req(p, wp, bp, addr, boff, bcount); 461 462 /* 463 * Building the sub-request failed, we probably need to 464 * clean up a lot. 465 */ 466 if (err) { 467 printf("GEOM_VINUM: plex request failed for "); 468 g_print_bio(bp); 469 printf("\n"); 470 TAILQ_FOREACH_SAFE(bq, &wp->bits, queue, bq2) { 471 TAILQ_REMOVE(&wp->bits, bq, queue); 472 g_free(bq); 473 } 474 if (wp->waiting != NULL) { 475 if (wp->waiting->bio_cflags & 476 GV_BIO_MALLOC) 477 g_free(wp->waiting->bio_data); 478 g_destroy_bio(wp->waiting); 479 } 480 if (wp->parity != NULL) { 481 if (wp->parity->bio_cflags & 482 GV_BIO_MALLOC) 483 g_free(wp->parity->bio_data); 484 g_destroy_bio(wp->parity); 485 } 486 g_free(wp); 487 488 TAILQ_FOREACH_SAFE(wp, &p->packets, list, wp2) { 489 if (wp->bio == bp) { 490 TAILQ_REMOVE(&p->packets, wp, 491 list); 492 TAILQ_FOREACH_SAFE(bq, 493 &wp->bits, queue, bq2) { 494 TAILQ_REMOVE(&wp->bits, 495 bq, queue); 496 g_free(bq); 497 } 498 g_free(wp); 499 } 500 } 501 502 cbp = bp->bio_driver1; 503 while (cbp != NULL) { 504 pbp = cbp->bio_caller1; 505 if (cbp->bio_cflags & GV_BIO_MALLOC) 506 g_free(cbp->bio_data); 507 g_destroy_bio(cbp); 508 cbp = pbp; 509 } 510 511 g_io_deliver(bp, err); 512 return; 513 } 514 515 if (TAILQ_EMPTY(&wp->bits)) 516 g_free(wp); 517 else if (wp->lockbase != -1) 518 TAILQ_INSERT_TAIL(&p->packets, wp, list); 519 520 /* 521 * Requests to concatenated and striped plexes go straight 522 * through. 523 */ 524 } else { 525 err = gv_plexbuffer(p, bp, addr, boff, bcount); 526 527 /* Building the sub-request failed. */ 528 if (err) { 529 printf("GEOM_VINUM: plex request failed for "); 530 g_print_bio(bp); 531 printf("\n"); 532 cbp = bp->bio_driver1; 533 while (cbp != NULL) { 534 pbp = cbp->bio_caller1; 535 g_destroy_bio(cbp); 536 cbp = pbp; 537 } 538 g_io_deliver(bp, err); 539 return; 540 } 541 } 542 543 /* Abuse bio_caller1 as linked list. */ 544 pbp = bp->bio_driver1; 545 while (pbp->bio_caller1 != NULL) 546 pbp = pbp->bio_caller1; 547 bcount -= pbp->bio_length; 548 addr += pbp->bio_length; 549 boff += pbp->bio_length; 550 } 551 552 /* Fire off all sub-requests. */ 553 pbp = bp->bio_driver1; 554 while (pbp != NULL) { 555 /* 556 * RAID5 sub-requests need to come in correct order, otherwise 557 * we trip over the parity, as it might be overwritten by 558 * another sub-request. 559 */ 560 if (pbp->bio_driver1 != NULL && 561 gv_stripe_active(p, pbp)) { 562 pbp->bio_cflags |= GV_BIO_ONHOLD; 563 bq = g_malloc(sizeof(*bq), M_WAITOK | M_ZERO); 564 bq->bp = pbp; 565 mtx_lock(&p->bqueue_mtx); 566 TAILQ_INSERT_TAIL(&p->bqueue, bq, queue); 567 mtx_unlock(&p->bqueue_mtx); 568 } else 569 g_io_request(pbp, pbp->bio_caller2); 570 pbp = pbp->bio_caller1; 571 } 572} 573 574static int 575gv_plex_access(struct g_provider *pp, int dr, int dw, int de) 576{ 577 struct g_geom *gp; 578 struct g_consumer *cp, *cp2; 579 int error; 580 581 gp = pp->geom; 582 583 error = ENXIO; 584 LIST_FOREACH(cp, &gp->consumer, consumer) { 585 error = g_access(cp, dr, dw, de); 586 if (error) { 587 LIST_FOREACH(cp2, &gp->consumer, consumer) { 588 if (cp == cp2) 589 break; 590 g_access(cp2, -dr, -dw, -de); 591 } 592 return (error); 593 } 594 } 595 return (error); 596} 597 598static struct g_geom * 599gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) 600{ 601 struct g_geom *gp; 602 struct g_consumer *cp, *cp2; 603 struct g_provider *pp2; 604 struct gv_plex *p; 605 struct gv_sd *s; 606 struct gv_softc *sc; 607 int error; 608 609 g_trace(G_T_TOPOLOGY, "gv_plex_taste(%s, %s)", mp->name, pp->name); 610 g_topology_assert(); 611 612 /* We only want to attach to subdisks. */ 613 if (strcmp(pp->geom->class->name, "VINUMDRIVE")) 614 return (NULL); 615 616 /* Find the VINUM class and its associated geom. */ 617 gp = find_vinum_geom(); 618 if (gp == NULL) 619 return (NULL); 620 sc = gp->softc; 621 KASSERT(sc != NULL, ("gv_plex_taste: NULL sc")); 622 623 /* Find out which subdisk the offered provider corresponds to. */ 624 s = pp->private; 625 KASSERT(s != NULL, ("gv_plex_taste: NULL s")); 626 627 /* Now find the correct plex where this subdisk belongs to. */ 628 p = gv_find_plex(sc, s->plex); 629 KASSERT(p != NULL, ("gv_plex_taste: NULL p")); 630 631 /* 632 * Add this subdisk to this plex. Since we trust the on-disk 633 * configuration, we don't check the given value (should we?). 634 * XXX: shouldn't be done here 635 */ 636 gv_sd_to_plex(p, s, 0); 637 638 /* Now check if there's already a geom for this plex. */ 639 gp = p->geom; 640 641 /* Yes, there is already a geom, so we just add the consumer. */ 642 if (gp != NULL) { 643 cp2 = LIST_FIRST(&gp->consumer); 644 /* Need to attach a new consumer to this subdisk. */ 645 cp = g_new_consumer(gp); 646 error = g_attach(cp, pp); 647 if (error) { 648 printf("geom_vinum: couldn't attach consumer to %s\n", 649 pp->name); 650 g_destroy_consumer(cp); 651 return (NULL); 652 } 653 /* Adjust the access counts of the new consumer. */ 654 if ((cp2 != NULL) && (cp2->acr || cp2->acw || cp2->ace)) { 655 error = g_access(cp, cp2->acr, cp2->acw, cp2->ace); 656 if (error) { 657 printf("geom_vinum: couldn't set access counts" 658 " for consumer on %s\n", pp->name); 659 g_detach(cp); 660 g_destroy_consumer(cp); 661 return (NULL); 662 } 663 } 664 s->consumer = cp; 665 666 /* Adjust the size of the providers this plex has. */ 667 LIST_FOREACH(pp2, &gp->provider, provider) 668 pp2->mediasize = p->size; 669 670 /* Update the size of the volume this plex is attached to. */ 671 if (p->vol_sc != NULL) 672 gv_update_vol_size(p->vol_sc, p->size); 673 674 return (NULL); 675 676 /* We need to create a new geom. */ 677 } else { 678 gp = g_new_geomf(mp, "%s", p->name); 679 gp->start = gv_plex_start; 680 gp->orphan = gv_plex_orphan; 681 gp->access = gv_plex_access; 682 gp->softc = p; 683 p->geom = gp; 684 685 TAILQ_INIT(&p->packets); 686 TAILQ_INIT(&p->bqueue); 687 mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF); 688 kthread_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s", 689 p->name); 690 p->flags |= GV_PLEX_THREAD_ACTIVE; 691 692 /* Attach a consumer to this provider. */ 693 cp = g_new_consumer(gp); 694 g_attach(cp, pp); 695 s->consumer = cp; 696 697 /* Create a provider for the outside world. */ 698 pp2 = g_new_providerf(gp, "gvinum/plex/%s", p->name); 699 pp2->mediasize = p->size; 700 pp2->sectorsize = pp->sectorsize; 701 p->provider = pp2; 702 g_error_provider(pp2, 0); 703 return (gp); 704 } 705} 706 707static int 708gv_plex_destroy_geom(struct gctl_req *req, struct g_class *mp, 709 struct g_geom *gp) 710{ 711 struct gv_plex *p; 712 713 g_trace(G_T_TOPOLOGY, "gv_plex_destroy_geom: %s", gp->name); 714 g_topology_assert(); 715 716 p = gp->softc; 717 718 KASSERT(p != NULL, ("gv_plex_destroy_geom: null p of '%s'", gp->name)); 719 720 /* 721 * If this is a RAID5 plex, check if its worker thread is still active 722 * and signal it to self destruct. 723 */ 724 gv_kill_plex_thread(p); 725 /* g_free(sc); */ 726 g_wither_geom(gp, ENXIO); 727 return (0); 728} 729 730#define VINUMPLEX_CLASS_NAME "VINUMPLEX" 731 732static struct g_class g_vinum_plex_class = { 733 .name = VINUMPLEX_CLASS_NAME, 734 .version = G_VERSION, 735 .taste = gv_plex_taste, 736 .destroy_geom = gv_plex_destroy_geom, 737}; 738 739DECLARE_GEOM_CLASS(g_vinum_plex_class, g_vinum_plex); 740