diff options
author | Allan Jude <[email protected]> | 2021-08-16 11:35:19 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-16 09:35:19 -0600 |
commit | e945e8d7f4fcafd4f1c01abd90810fc09ab6a811 (patch) | |
tree | bd303352b4c601274ec9418d43d2d29c9602e6d6 /include | |
parent | 41bee4039c546a8f700e173694be2dba3e34a7ce (diff) |
Restore FreeBSD sysctl processing for arc.min and arc.max
Before OpenZFS 2.0, trying to set the FreeBSD sysctl vfs.zfs.arc_max
to a disallowed value would return an error.
Since the switch, it instead only generates WARN_IF_TUNING_IGNORED
Keep the ability to set the sysctl's specifically to 0, even though
that is less than the minimum, because some tests depend on this.
Also lost, was the ability to set vfs.zfs.arc_max to a value less
than the default vfs.zfs.arc_min at boot time. Restore this as well.
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Allan Jude <[email protected]>
Closes #12161
Diffstat (limited to 'include')
-rw-r--r-- | include/os/freebsd/spl/sys/mod_os.h | 6 | ||||
-rw-r--r-- | include/sys/arc.h | 7 | ||||
-rw-r--r-- | include/sys/arc_impl.h | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/os/freebsd/spl/sys/mod_os.h b/include/os/freebsd/spl/sys/mod_os.h index 5b3b3271e..5695abee7 100644 --- a/include/os/freebsd/spl/sys/mod_os.h +++ b/include/os/freebsd/spl/sys/mod_os.h @@ -62,6 +62,12 @@ #define param_set_arc_long_args(var) \ CTLTYPE_ULONG, &var, 0, param_set_arc_long, "LU" +#define param_set_arc_min_args(var) \ + CTLTYPE_ULONG, &var, 0, param_set_arc_min, "LU" + +#define param_set_arc_max_args(var) \ + CTLTYPE_ULONG, &var, 0, param_set_arc_max, "LU" + #define param_set_arc_int_args(var) \ CTLTYPE_INT, &var, 0, param_set_arc_int, "I" diff --git a/include/sys/arc.h b/include/sys/arc.h index 20fa47bd9..afbe65bb1 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -46,6 +46,13 @@ extern "C" { */ #define ARC_EVICT_ALL UINT64_MAX +/* + * ZFS gets very unhappy when the maximum ARC size is smaller than the maximum + * block size and a larger block is written. To leave some safety margin, we + * limit the minimum for zfs_arc_max to the maximium transaction size. + */ +#define MIN_ARC_MAX DMU_MAX_ACCESS + #define HDR_SET_LSIZE(hdr, x) do { \ ASSERT(IS_P2ALIGNED(x, 1U << SPA_MINBLOCKSHIFT)); \ (hdr)->b_lsize = ((x) >> SPA_MINBLOCKSHIFT); \ diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index f99d2911b..89be78ce2 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -1004,6 +1004,8 @@ extern void arc_unregister_hotplug(void); extern int param_set_arc_long(ZFS_MODULE_PARAM_ARGS); extern int param_set_arc_int(ZFS_MODULE_PARAM_ARGS); +extern int param_set_arc_min(ZFS_MODULE_PARAM_ARGS); +extern int param_set_arc_max(ZFS_MODULE_PARAM_ARGS); /* used in zdb.c */ boolean_t l2arc_log_blkptr_valid(l2arc_dev_t *dev, |