Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/shsec/g_shsec.c
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | struct g_class g_shsec_class = { | ||||
.destroy_geom = g_shsec_destroy_geom, | .destroy_geom = g_shsec_destroy_geom, | ||||
.init = g_shsec_init, | .init = g_shsec_init, | ||||
.fini = g_shsec_fini | .fini = g_shsec_fini | ||||
}; | }; | ||||
SYSCTL_DECL(_kern_geom); | SYSCTL_DECL(_kern_geom); | ||||
static SYSCTL_NODE(_kern_geom, OID_AUTO, shsec, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | static SYSCTL_NODE(_kern_geom, OID_AUTO, shsec, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | ||||
"GEOM_SHSEC stuff"); | "GEOM_SHSEC stuff"); | ||||
static u_int g_shsec_debug = 0; | static u_int g_shsec_debug; | ||||
SYSCTL_UINT(_kern_geom_shsec, OID_AUTO, debug, CTLFLAG_RWTUN, &g_shsec_debug, 0, | SYSCTL_UINT(_kern_geom_shsec, OID_AUTO, debug, CTLFLAG_RWTUN, &g_shsec_debug, 0, | ||||
"Debug level"); | "Debug level"); | ||||
static u_int g_shsec_maxmem = MAXPHYS * 100; | static u_long g_shsec_maxmem; | ||||
SYSCTL_UINT(_kern_geom_shsec, OID_AUTO, maxmem, CTLFLAG_RDTUN, &g_shsec_maxmem, | SYSCTL_ULONG(_kern_geom_shsec, OID_AUTO, maxmem, | ||||
CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &g_shsec_maxmem, | |||||
0, "Maximum memory that can be allocated for I/O (in bytes)"); | 0, "Maximum memory that can be allocated for I/O (in bytes)"); | ||||
static u_int g_shsec_alloc_failed = 0; | static u_int g_shsec_alloc_failed = 0; | ||||
SYSCTL_UINT(_kern_geom_shsec, OID_AUTO, alloc_failed, CTLFLAG_RD, | SYSCTL_UINT(_kern_geom_shsec, OID_AUTO, alloc_failed, CTLFLAG_RD, | ||||
&g_shsec_alloc_failed, 0, "How many times I/O allocation failed"); | &g_shsec_alloc_failed, 0, "How many times I/O allocation failed"); | ||||
/* | /* | ||||
* Greatest Common Divisor. | * Greatest Common Divisor. | ||||
*/ | */ | ||||
Show All 19 Lines | lcm(u_int a, u_int b) | ||||
return ((a * b) / gcd(a, b)); | return ((a * b) / gcd(a, b)); | ||||
} | } | ||||
static void | static void | ||||
g_shsec_init(struct g_class *mp __unused) | g_shsec_init(struct g_class *mp __unused) | ||||
{ | { | ||||
g_shsec_zone = uma_zcreate("g_shsec_zone", MAXPHYS, NULL, NULL, NULL, | g_shsec_maxmem = maxphys * 100; | ||||
TUNABLE_ULONG_FETCH("kern.geom.shsec.maxmem,", &g_shsec_maxmem); | |||||
g_shsec_zone = uma_zcreate("g_shsec_zone", maxphys, NULL, NULL, NULL, | |||||
NULL, 0, 0); | NULL, 0, 0); | ||||
g_shsec_maxmem -= g_shsec_maxmem % MAXPHYS; | g_shsec_maxmem -= g_shsec_maxmem % maxphys; | ||||
uma_zone_set_max(g_shsec_zone, g_shsec_maxmem / MAXPHYS); | uma_zone_set_max(g_shsec_zone, g_shsec_maxmem / maxphys); | ||||
} | } | ||||
static void | static void | ||||
g_shsec_fini(struct g_class *mp __unused) | g_shsec_fini(struct g_class *mp __unused) | ||||
{ | { | ||||
uma_zdestroy(g_shsec_zone); | uma_zdestroy(g_shsec_zone); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 710 Lines • Show Last 20 Lines |