1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Added missing ZFS sysctls

* vfs.zfs.vdev.async_write_active_min_dirty_percent
* vfs.zfs.vdev.async_write_active_max_dirty_percent

Added validation of min / max for ZFS sysctl
* vfs.zfs.dirty_data_max_percent

MFC after:	3 days
This commit is contained in:
Steven Hartland 2014-09-14 12:23:00 +00:00
parent 959ec2581b
commit a889b18c52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271589
2 changed files with 75 additions and 2 deletions

View File

@ -145,8 +145,10 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max_max, CTLFLAG_RDTUN,
&zfs_dirty_data_max_max, 0,
"The absolute cap on dirty_data_max when auto calculating");
SYSCTL_INT(_vfs_zfs, OID_AUTO, dirty_data_max_percent, CTLFLAG_RDTUN,
&zfs_dirty_data_max_percent, 0,
static int sysctl_zfs_dirty_data_max_percent(SYSCTL_HANDLER_ARGS);
SYSCTL_PROC(_vfs_zfs, OID_AUTO, dirty_data_max_percent,
CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_zfs_dirty_data_max_percent, "I",
"The percent of physical memory used to auto calculate dirty_data_max");
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync, CTLFLAG_RWTUN,
@ -167,6 +169,24 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_scale,
sysctl_zfs_delay_scale, "QU",
"Controls how quickly the delay approaches infinity");
static int
sysctl_zfs_dirty_data_max_percent(SYSCTL_HANDLER_ARGS)
{
int val, err;
val = zfs_dirty_data_max_percent;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
if (val < 0 || val > 100)
return (EINVAL);
zfs_dirty_data_max_percent = val;
return (0);
}
static int
sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS)
{

View File

@ -176,6 +176,21 @@ int zfs_vdev_write_gap_limit = 4 << 10;
#ifdef __FreeBSD__
SYSCTL_DECL(_vfs_zfs_vdev);
static int sysctl_zfs_async_write_active_min_dirty_percent(SYSCTL_HANDLER_ARGS);
SYSCTL_PROC(_vfs_zfs_vdev, OID_AUTO, async_write_active_min_dirty_percent,
CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_zfs_async_write_active_min_dirty_percent, "I",
"Percentage of async write dirty data below which "
"async_write_min_active is used.");
static int sysctl_zfs_async_write_active_max_dirty_percent(SYSCTL_HANDLER_ARGS);
SYSCTL_PROC(_vfs_zfs_vdev, OID_AUTO, async_write_active_max_dirty_percent,
CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_zfs_async_write_active_max_dirty_percent, "I",
"Percentage of async write dirty data above which "
"async_write_max_active is used.");
SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, max_active, CTLFLAG_RWTUN,
&zfs_vdev_max_active, 0,
"The maximum number of I/Os of all types active for each device.");
@ -216,6 +231,44 @@ SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, read_gap_limit, CTLFLAG_RWTUN,
SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, write_gap_limit, CTLFLAG_RWTUN,
&zfs_vdev_write_gap_limit, 0,
"Acceptable gap between two writes being aggregated");
static int
sysctl_zfs_async_write_active_min_dirty_percent(SYSCTL_HANDLER_ARGS)
{
int val, err;
val = zfs_vdev_async_write_active_min_dirty_percent;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
if (val < 0 || val > 100 ||
val >= zfs_vdev_async_write_active_max_dirty_percent)
return (EINVAL);
zfs_vdev_async_write_active_min_dirty_percent = val;
return (0);
}
static int
sysctl_zfs_async_write_active_max_dirty_percent(SYSCTL_HANDLER_ARGS)
{
int val, err;
val = zfs_vdev_async_write_active_max_dirty_percent;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
if (val < 0 || val > 100 ||
val <= zfs_vdev_async_write_active_min_dirty_percent)
return (EINVAL);
zfs_vdev_async_write_active_max_dirty_percent = val;
return (0);
}
#endif
int