Index: g_bde.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/bde/g_bde.c,v retrieving revision 1.28 diff -u -p -r1.28 g_bde.c --- g_bde.c 8 Aug 2004 07:57:51 -0000 1.28 +++ g_bde.c 22 Jan 2005 20:31:09 -0000 @@ -42,6 +42,8 @@ #include #include +#include + #include #include #include @@ -156,6 +158,10 @@ g_bde_create_geom(struct gctl_req *req, sectorsize = cp->provider->sectorsize; mediasize = cp->provider->mediasize; sc = g_malloc(sizeof(struct g_bde_softc), M_WAITOK | M_ZERO); + sc->work_zone = uma_zcreate("g_bde_work", + sizeof(struct g_bde_work), NULL, NULL, NULL, NULL, 0, 0); + sc->sector_zone = uma_zcreate("g_bde_sector", + sizeof(struct g_bde_sector), NULL, NULL, NULL, NULL, 0, 0); gp->softc = sc; sc->geom = gp; sc->consumer = cp; @@ -210,8 +216,11 @@ g_bde_create_geom(struct gctl_req *req, g_access(cp, -1, -1, -1); g_detach(cp); g_destroy_consumer(cp); - if (gp->softc != NULL) + if (gp->softc != NULL) { + uma_zdestroy(sc->work_zone); + uma_zdestroy(sc->sector_zone); g_free(gp->softc); + } g_destroy_geom(gp); return; } @@ -246,6 +255,8 @@ g_bde_destroy_geom(struct gctl_req *req, tsleep(sc, PRIBIO, "g_bdedie", hz); mtx_destroy(&sc->worklist_mutex); bzero(&sc->key, sizeof sc->key); + uma_zdestroy(sc->work_zone); + uma_zdestroy(sc->sector_zone); g_free(sc); g_wither_geom(gp, ENXIO); return (0); Index: g_bde.h =================================================================== RCS file: /private/FreeBSD/src/sys/geom/bde/g_bde.h,v retrieving revision 1.6 diff -u -p -r1.6 g_bde.h --- g_bde.h 7 Oct 2003 09:28:07 -0000 1.6 +++ g_bde.h 22 Jan 2005 18:04:17 -0000 @@ -134,6 +134,8 @@ struct g_bde_softc { struct mtx worklist_mutex; struct proc *thread; struct g_bde_key key; + uma_zone_t work_zone; + uma_zone_t sector_zone; int dead; u_int nwork; u_int nsect; Index: g_bde_crypt.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/bde/g_bde_crypt.c,v retrieving revision 1.21 diff -u -p -r1.21 g_bde_crypt.c --- g_bde_crypt.c 6 Jan 2005 18:27:29 -0000 1.21 +++ g_bde_crypt.c 22 Jan 2005 20:31:26 -0000 @@ -46,6 +46,8 @@ #include #include +#include + #include #include Index: g_bde_lock.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/bde/g_bde_lock.c,v retrieving revision 1.15 diff -u -p -r1.15 g_bde_lock.c --- g_bde_lock.c 6 Jan 2005 18:27:29 -0000 1.15 +++ g_bde_lock.c 22 Jan 2005 20:31:56 -0000 @@ -46,6 +46,7 @@ #ifdef _KERNEL #include #include +#include #else #include #define CTASSERT(foo) Index: g_bde_work.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/bde/g_bde_work.c,v retrieving revision 1.25 diff -u -p -r1.25 g_bde_work.c --- g_bde_work.c 6 Jan 2005 18:27:29 -0000 1.25 +++ g_bde_work.c 22 Jan 2005 20:33:07 -0000 @@ -70,6 +70,7 @@ #include #include +#include #include #include #include @@ -97,7 +98,7 @@ g_bde_new_work(struct g_bde_softc *sc) { struct g_bde_work *wp; - wp = malloc(sizeof *wp, M_GBDE, M_NOWAIT | M_ZERO); + wp = uma_zalloc(sc->work_zone, M_NOWAIT | M_ZERO); if (wp == NULL) return (wp); wp->state = SETUP; @@ -117,7 +118,7 @@ g_bde_delete_work(struct g_bde_work *wp) g_bde_nwork--; sc->nwork--; TAILQ_REMOVE(&sc->worklist, wp, list); - free(wp, M_GBDE); + uma_zfree(sc->work_zone, wp); } /* @@ -137,7 +138,7 @@ g_bde_delete_sector(struct g_bde_softc * sc->nsect--; if (sp->malloc) free(sp->data, M_GBDE); - free(sp, M_GBDE); + uma_zfree(sc->sector_zone, sp); } static struct g_bde_sector * @@ -145,13 +146,13 @@ g_bde_new_sector(struct g_bde_work *wp, { struct g_bde_sector *sp; - sp = malloc(sizeof *sp, M_GBDE, M_NOWAIT | M_ZERO); + sp = uma_zalloc(wp->softc->sector_zone, M_NOWAIT | M_ZERO); if (sp == NULL) return (sp); if (len > 0) { sp->data = malloc(len, M_GBDE, M_NOWAIT | M_ZERO); if (sp->data == NULL) { - free(sp, M_GBDE); + uma_zfree(wp->softc->sector_zone, sp); return (NULL); } sp->malloc = 1;