1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

geom(4): Mark all sysctls as CTLFLAG_MPSAFE.

This code does not use Giant lock for very long time.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2021-08-10 20:18:46 -04:00
parent 303477d325
commit c2da954203
6 changed files with 12 additions and 24 deletions

View File

@ -85,11 +85,11 @@ sysctl_handle_pct(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_lo,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &g_cache_used_lo, 0,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, &g_cache_used_lo, 0,
sysctl_handle_pct, "IU",
"");
SYSCTL_PROC(_kern_geom_cache, OID_AUTO, used_hi,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &g_cache_used_hi, 0,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, &g_cache_used_hi, 0,
sysctl_handle_pct, "IU",
"");

View File

@ -745,7 +745,7 @@ g_disk_create(void *arg, int flag)
"LED name");
SYSCTL_ADD_PROC(&sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags",
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dp, 0,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, dp, 0,
g_disk_sysctl_flags, "A", "Report disk flags");
}
pp->private = sc;

View File

@ -208,17 +208,17 @@ SYSCTL_NODE(_kern, OID_AUTO, geom, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"GEOMetry management");
SYSCTL_PROC(_kern_geom, OID_AUTO, confxml,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, 0, 0,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0,
sysctl_kern_geom_confxml, "",
"Dump the GEOM config in XML");
SYSCTL_PROC(_kern_geom, OID_AUTO, confdot,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, 0, 0,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0,
sysctl_kern_geom_confdot, "",
"Dump the GEOM config in dot");
SYSCTL_PROC(_kern_geom, OID_AUTO, conftxt,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, 0, 0,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0,
sysctl_kern_geom_conftxt, "",
"Dump the GEOM config in txt");

View File

@ -129,7 +129,7 @@ g_journal_record_entries_sysctl(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entries,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, NULL, 0,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0,
g_journal_record_entries_sysctl, "I",
"Maximum number of entires in one journal record");
SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW,
@ -163,7 +163,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit,
CTLTYPE_ULONG | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, NULL, 0,
CTLTYPE_ULONG | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, NULL, 0,
g_journal_cache_limit_sysctl, "I",
"Maximum number of allocated bytes");
SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN,
@ -186,7 +186,7 @@ g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, switch,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, NULL, 0,
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0,
g_journal_cache_switch_sysctl, "I",
"Force switch when we hit this percent of cache use");
SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, misses, CTLFLAG_RW,

View File

@ -77,20 +77,8 @@ static u_int g_stripe_debug = 0;
SYSCTL_UINT(_kern_geom_stripe, OID_AUTO, debug, CTLFLAG_RWTUN, &g_stripe_debug, 0,
"Debug level");
static int g_stripe_fast = 0;
static int
g_sysctl_stripe_fast(SYSCTL_HANDLER_ARGS)
{
int error, fast;
fast = g_stripe_fast;
error = sysctl_handle_int(oidp, &fast, 0, req);
if (error == 0 && req->newptr != NULL)
g_stripe_fast = fast;
return (error);
}
SYSCTL_PROC(_kern_geom_stripe, OID_AUTO, fast,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, NULL, 0,
g_sysctl_stripe_fast, "I",
SYSCTL_INT(_kern_geom_stripe, OID_AUTO, fast,
CTLFLAG_RWTUN, &g_stripe_fast, 0,
"Fast, but memory-consuming, mode");
static u_long g_stripe_maxmem;
SYSCTL_ULONG(_kern_geom_stripe, OID_AUTO, maxmem,

View File

@ -49,7 +49,7 @@ static SYSCTL_NODE(_kern_geom, OID_AUTO, zero, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"GEOM_ZERO stuff");
static int g_zero_clear = 1;
SYSCTL_PROC(_kern_geom_zero, OID_AUTO, clear,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &g_zero_clear, 0,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &g_zero_clear, 0,
g_zero_clear_sysctl, "I",
"Clear read data buffer");
static int g_zero_byte = 0;