summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-05-05 08:37:07 +0000
committerphk <phk@FreeBSD.org>2003-05-05 08:37:07 +0000
commitd6ece911bbedbb5ea2694ad856ca4e9ec462f42a (patch)
tree2c47e0fbc2289c39856d1b71b3f293f868932576 /sys
parentd4c2dfcea2076fc90a06d02dfbc318796452820e (diff)
downloadFreeBSD-src-d6ece911bbedbb5ea2694ad856ca4e9ec462f42a.zip
FreeBSD-src-d6ece911bbedbb5ea2694ad856ca4e9ec462f42a.tar.gz
Use a dedicated malloc(9) bucket for sector storage.
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/bde/g_bde_work.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/geom/bde/g_bde_work.c b/sys/geom/bde/g_bde_work.c
index e78a37d..9d0b8d9 100644
--- a/sys/geom/bde/g_bde_work.c
+++ b/sys/geom/bde/g_bde_work.c
@@ -89,12 +89,14 @@ static void g_bde_purge_sector(struct g_bde_softc *sc, int fraction);
static u_int g_bde_nwork;
SYSCTL_UINT(_debug, OID_AUTO, gbde_nwork, CTLFLAG_RD, &g_bde_nwork, 0, "");
+static MALLOC_DEFINE(M_GBDE, "GBDE", "GBDE data structures");
+
static struct g_bde_work *
g_bde_new_work(struct g_bde_softc *sc)
{
struct g_bde_work *wp;
- wp = g_malloc(sizeof *wp, M_NOWAIT | M_ZERO);
+ wp = malloc(sizeof *wp, M_GBDE, M_NOWAIT | M_ZERO);
if (wp == NULL)
return (wp);
wp->state = SETUP;
@@ -114,7 +116,7 @@ g_bde_delete_work(struct g_bde_work *wp)
g_bde_nwork--;
sc->nwork--;
TAILQ_REMOVE(&sc->worklist, wp, list);
- g_free(wp);
+ free(wp, M_GBDE);
}
/*
@@ -133,8 +135,8 @@ g_bde_delete_sector(struct g_bde_softc *sc, struct g_bde_sector *sp)
g_bde_nsect--;
sc->nsect--;
if (sp->malloc)
- g_free(sp->data);
- g_free(sp);
+ free(sp->data, M_GBDE);
+ free(sp, M_GBDE);
}
static struct g_bde_sector *
@@ -142,13 +144,13 @@ g_bde_new_sector(struct g_bde_work *wp, u_int len)
{
struct g_bde_sector *sp;
- sp = g_malloc(sizeof *sp, M_NOWAIT | M_ZERO);
+ sp = malloc(sizeof *sp, M_GBDE, M_NOWAIT | M_ZERO);
if (sp == NULL)
return (sp);
if (len > 0) {
- sp->data = g_malloc(len, M_NOWAIT | M_ZERO);
+ sp->data = malloc(len, M_GBDE, M_NOWAIT | M_ZERO);
if (sp->data == NULL) {
- g_free(sp);
+ free(sp, M_GBDE);
return (NULL);
}
sp->malloc = 1;
OpenPOWER on IntegriCloud