Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/cache/g_cache.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
SYSCTL_DECL(_kern_geom); | SYSCTL_DECL(_kern_geom); | ||||
static SYSCTL_NODE(_kern_geom, OID_AUTO, cache, CTLFLAG_RW, 0, | static SYSCTL_NODE(_kern_geom, OID_AUTO, cache, CTLFLAG_RW, 0, | ||||
"GEOM_CACHE stuff"); | "GEOM_CACHE stuff"); | ||||
static u_int g_cache_debug = 0; | static u_int g_cache_debug = 0; | ||||
SYSCTL_UINT(_kern_geom_cache, OID_AUTO, debug, CTLFLAG_RW, &g_cache_debug, 0, | SYSCTL_UINT(_kern_geom_cache, OID_AUTO, debug, CTLFLAG_RW, &g_cache_debug, 0, | ||||
"Debug level"); | "Debug level"); | ||||
static u_int g_cache_enable = 1; | static u_int g_cache_enable = 1; | ||||
SYSCTL_UINT(_kern_geom_cache, OID_AUTO, enable, CTLFLAG_RW, &g_cache_enable, 0, | SYSCTL_UINT(_kern_geom_cache, OID_AUTO, enable, CTLFLAG_RW, &g_cache_enable, 0, | ||||
""); | "Enable cache"); | ||||
static u_int g_cache_timeout = 10; | static u_int g_cache_timeout = 10; | ||||
SYSCTL_UINT(_kern_geom_cache, OID_AUTO, timeout, CTLFLAG_RW, &g_cache_timeout, | SYSCTL_UINT(_kern_geom_cache, OID_AUTO, timeout, CTLFLAG_RW, &g_cache_timeout, | ||||
0, ""); | 0, "Cache timeout in seconds"); | ||||
static u_int g_cache_idletime = 5; | static u_int g_cache_idletime = 5; | ||||
SYSCTL_UINT(_kern_geom_cache, OID_AUTO, idletime, CTLFLAG_RW, &g_cache_idletime, | SYSCTL_UINT(_kern_geom_cache, OID_AUTO, idletime, CTLFLAG_RW, &g_cache_idletime, | ||||
0, ""); | 0, "Maximum time in seconds before idle cache entries are cleared"); | ||||
static u_int g_cache_used_lo = 5; | static u_int g_cache_used_lo = 5; | ||||
static u_int g_cache_used_hi = 20; | static u_int g_cache_used_hi = 20; | ||||
static int | static int | ||||
sysctl_handle_pct(SYSCTL_HANDLER_ARGS) | sysctl_handle_pct(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
u_int val = *(u_int *)arg1; | u_int val = *(u_int *)arg1; | ||||
int error; | int error; | ||||
error = sysctl_handle_int(oidp, &val, 0, req); | error = sysctl_handle_int(oidp, &val, 0, req); | ||||
if (error || !req->newptr) | if (error || !req->newptr) | ||||
return (error); | return (error); | ||||
if (val > 100) | if (val > 100) | ||||
return (EINVAL); | return (EINVAL); | ||||
if ((arg1 == &g_cache_used_lo && val > g_cache_used_hi) || | if ((arg1 == &g_cache_used_lo && val > g_cache_used_hi) || | ||||
(arg1 == &g_cache_used_hi && g_cache_used_lo > val)) | (arg1 == &g_cache_used_hi && g_cache_used_lo > val)) | ||||
return (EINVAL); | return (EINVAL); | ||||
*(u_int *)arg1 = val; | *(u_int *)arg1 = val; | ||||
return (0); | return (0); | ||||
} | } | ||||
SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_lo, CTLTYPE_UINT|CTLFLAG_RW, | SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_lo, CTLTYPE_UINT|CTLFLAG_RW, | ||||
&g_cache_used_lo, 0, sysctl_handle_pct, "IU", ""); | &g_cache_used_lo, 0, sysctl_handle_pct, "IU", | ||||
"Minimum cache entries"); | |||||
SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_hi, CTLTYPE_UINT|CTLFLAG_RW, | SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_hi, CTLTYPE_UINT|CTLFLAG_RW, | ||||
&g_cache_used_hi, 0, sysctl_handle_pct, "IU", ""); | &g_cache_used_hi, 0, sysctl_handle_pct, "IU", | ||||
"Maximum cache entries"); | |||||
static int g_cache_destroy(struct g_cache_softc *sc, boolean_t force); | static int g_cache_destroy(struct g_cache_softc *sc, boolean_t force); | ||||
static g_ctl_destroy_geom_t g_cache_destroy_geom; | static g_ctl_destroy_geom_t g_cache_destroy_geom; | ||||
static g_taste_t g_cache_taste; | static g_taste_t g_cache_taste; | ||||
static g_ctl_req_t g_cache_config; | static g_ctl_req_t g_cache_config; | ||||
static g_dumpconf_t g_cache_dumpconf; | static g_dumpconf_t g_cache_dumpconf; | ||||
▲ Show 20 Lines • Show All 921 Lines • Show Last 20 Lines |