diff options
author | loli10K <[email protected]> | 2019-10-27 00:22:19 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-26 15:22:19 -0700 |
commit | e35704647e84c62c6a6017ead0b66b446010e4ff (patch) | |
tree | da45b7d329f00cf2aaa2b6e0420a933e1d6784fd /include | |
parent | 6963414d7049b52047982fd94bfc16522bc5c26c (diff) |
Fix for ARC sysctls ignored at runtime
This change leverage module_param_call() to run arc_tuning_update()
immediately after the ARC tunable has been updated as suggested in
cffa8372 code review.
A simple test case is added to the ZFS Test Suite to prevent future
regressions in functionality.
Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #9487
Closes #9489
Diffstat (limited to 'include')
-rw-r--r-- | include/os/linux/kernel/linux/mod_compat.h | 46 | ||||
-rw-r--r-- | include/sys/arc_impl.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_context.h | 6 |
3 files changed, 47 insertions, 9 deletions
diff --git a/include/os/linux/kernel/linux/mod_compat.h b/include/os/linux/kernel/linux/mod_compat.h index 1f19f4b40..5579cb5bf 100644 --- a/include/os/linux/kernel/linux/mod_compat.h +++ b/include/os/linux/kernel/linux/mod_compat.h @@ -76,26 +76,26 @@ enum scope_prefix_types { /* * Declare a module parameter / sysctl node * - * scope_prefix the part of the the sysctl / sysfs tree the node resides under + * "scope_prefix" the part of the the sysctl / sysfs tree the node resides under * (currently a no-op on Linux) - * name_prefix the part of the variable name that will be excluded from the + * "name_prefix" the part of the variable name that will be excluded from the * exported names on platforms with a hierarchical namespace - * name the part of the variable that will be exposed on platforms with a + * "name" the part of the variable that will be exposed on platforms with a * hierarchical namespace, or as name_prefix ## name on Linux - * type the variable type - * perm the permissions (read/write or read only) - * desc a brief description of the option + * "type" the variable type + * "perm" the permissions (read/write or read only) + * "desc" a brief description of the option * * Examples: * ZFS_MODULE_PARAM(zfs_vdev_mirror, zfs_vdev_mirror_, rotating_inc, UINT, - * ZMOD_RW, "Rotating media load increment for non-seeking I/O's"); + * ZMOD_RW, "Rotating media load increment for non-seeking I/O's"); * on FreeBSD: * vfs.zfs.vdev.mirror.rotating_inc * on Linux: * zfs_vdev_mirror_rotating_inc * - * *ZFS_MODULE_PARAM(zfs, , dmu_prefetch_max, UINT, ZMOD_RW, - * "Limit one prefetch call to this size"); + * ZFS_MODULE_PARAM(zfs, , dmu_prefetch_max, UINT, ZMOD_RW, + * "Limit one prefetch call to this size"); * on FreeBSD: * vfs.zfs.dmu_prefetch_max * on Linux: @@ -108,5 +108,33 @@ enum scope_prefix_types { MODULE_PARM_DESC(name_prefix ## name, desc) /* END CSTYLED */ +/* + * Declare a module parameter / sysctl node + * + * "scope_prefix" the part of the the sysctl / sysfs tree the node resides under + * (currently a no-op on Linux) + * "name_prefix" the part of the variable name that will be excluded from the + * exported names on platforms with a hierarchical namespace + * "name" the part of the variable that will be exposed on platforms with a + * hierarchical namespace, or as name_prefix ## name on Linux + * "setfunc" setter function + * "getfunc" getter function + * "perm" the permissions (read/write or read only) + * "desc" a brief description of the option + * + * Examples: + * ZFS_MODULE_PARAM_CALL(zfs_spa, spa_, slop_shift, param_set_slop_shift, + * param_get_int, ZMOD_RW, "Reserved free space in pool"); + * on FreeBSD: + * vfs.zfs.spa_slop_shift + * on Linux: + * spa_slop_shift + */ +/* BEGIN CSTYLED */ +#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, getfunc, perm, desc) \ + CTASSERT_GLOBAL((sizeof (scope_prefix) == sizeof (enum scope_prefix_types))); \ + module_param_call(name_prefix ## name, setfunc, getfunc, &name_prefix ## name, perm); \ + MODULE_PARM_DESC(name_prefix ## name, desc) +/* END CSTYLED */ #endif /* _MOD_COMPAT_H */ diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index 28d430f04..8eeee54c9 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -611,6 +611,10 @@ extern void arc_prune_async(int64_t); extern int arc_memory_throttle(spa_t *spa, uint64_t reserve, uint64_t txg); extern uint64_t arc_free_memory(void); extern int64_t arc_available_memory(void); +extern void arc_tuning_update(void); + +extern int param_set_arc_long(const char *buf, zfs_kernel_param_t *kp); +extern int param_set_arc_int(const char *buf, zfs_kernel_param_t *kp); #ifdef __cplusplus } diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index a493c30dd..18d9b25a3 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -198,7 +198,13 @@ extern int aok; /* * Tunables. */ +typedef struct zfs_kernel_param { + const char *name; /* unused stub */ +} zfs_kernel_param_t; + #define ZFS_MODULE_PARAM(scope_prefix, name_prefix, name, type, perm, desc) +#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, \ + getfunc, perm, desc) /* * Exported symbols |