Deleted Added
full compact
37c37
< __FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 248516 2013-03-19 14:49:15Z kib $");
---
> __FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 248694 2013-03-25 05:45:24Z mav $");
62a63
> struct mtx done_mtx;
70,71d70
< static struct mtx g_disk_done_mtx;
<
73,74d71
< static g_init_t g_disk_init;
< static g_fini_t g_disk_fini;
83,84d79
< .init = g_disk_init,
< .fini = g_disk_fini,
96,109d90
< static void
< g_disk_init(struct g_class *mp __unused)
< {
<
< mtx_init(&g_disk_done_mtx, "g_disk_done", NULL, MTX_DEF);
< }
<
< static void
< g_disk_fini(struct g_class *mp __unused)
< {
<
< mtx_destroy(&g_disk_done_mtx);
< }
<
138c119
< sc = pp->geom->softc;
---
> sc = pp->private;
243d223
< struct disk *dp;
248,250d227
< mtx_lock(&g_disk_done_mtx);
< bp->bio_completed = bp->bio_length - bp->bio_resid;
<
251a229,231
> sc = bp2->bio_to->private;
> bp->bio_completed = bp->bio_length - bp->bio_resid;
> mtx_lock(&sc->done_mtx);
255,259c235,236
< if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0 &&
< (sc = bp2->bio_to->geom->softc) != NULL &&
< (dp = sc->dp) != NULL) {
< devstat_end_transaction_bio(dp->d_devstat, bp);
< }
---
> if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0)
> devstat_end_transaction_bio(sc->dp->d_devstat, bp);
266c243
< mtx_unlock(&g_disk_done_mtx);
---
> mtx_unlock(&sc->done_mtx);
272d248
< struct g_geom *gp;
277,278c253
< gp = pp->geom;
< sc = gp->softc;
---
> sc = pp->private;
298c273
< sc = bp->bio_to->geom->softc;
---
> sc = bp->bio_to->private;
498a474
> mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF);
542,550c518
< sc = (struct g_disk_softc *)pp->geom->softc;
<
< /*
< * If the softc is already NULL, then we've probably been through
< * g_disk_destroy already; there is nothing for us to do anyway.
< */
< if (sc == NULL)
< return;
<
---
> sc = (struct g_disk_softc *)pp->private;
552,553c520
<
< if (dp->d_gone != NULL)
---
> if (dp != NULL && dp->d_gone != NULL)
554a522,533
> if (sc->sysctl_tree != NULL) {
> sysctl_ctx_free(&sc->sysctl_ctx);
> sc->sysctl_tree = NULL;
> }
> if (sc->led[0] != 0) {
> led_set(sc->led, "0");
> sc->led[0] = 0;
> }
> pp->private = NULL;
> pp->geom->softc = NULL;
> mtx_destroy(&sc->done_mtx);
> g_free(sc);
569,578c548,550
< if (sc->sysctl_tree != NULL) {
< sysctl_ctx_free(&sc->sysctl_ctx);
< sc->sysctl_tree = NULL;
< }
< if (sc->led[0] != 0) {
< led_set(sc->led, "0");
< sc->led[0] = 0;
< }
< g_free(sc);
< gp->softc = NULL;
---
> if (sc != NULL)
> sc->dp = NULL;
> dp->d_geom = NULL;