FreeBSD: Fix format of vfs.zfs.arc_no_grow_shift
vfs.zfs.arc_no_grow_shift has an invalid type (15) and this causes py-sysctl to format it as a bytearray when it should be an integer. "U" is not a valid format, it should be "I" and the type should match the variable type, int. We can return EINVAL if the value is set below zero. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11318
This commit is contained in:
parent
513c196200
commit
8c5606ca0b
@ -229,15 +229,14 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD,
|
||||
static int
|
||||
sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
uint32_t val;
|
||||
int err;
|
||||
int err, val;
|
||||
|
||||
val = arc_no_grow_shift;
|
||||
err = sysctl_handle_32(oidp, &val, 0, req);
|
||||
err = sysctl_handle_int(oidp, &val, 0, req);
|
||||
if (err != 0 || req->newptr == NULL)
|
||||
return (err);
|
||||
|
||||
if (val >= arc_shrink_shift)
|
||||
if (val < 0 || val >= arc_shrink_shift)
|
||||
return (EINVAL);
|
||||
|
||||
arc_no_grow_shift = val;
|
||||
@ -245,8 +244,8 @@ sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_no_grow_shift,
|
||||
CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof (uint32_t),
|
||||
sysctl_vfs_zfs_arc_no_grow_shift, "U",
|
||||
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, NULL, sizeof (int),
|
||||
sysctl_vfs_zfs_arc_no_grow_shift, "I",
|
||||
"log2(fraction of ARC which must be free to allow growing)");
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user