From b0e053a10dc84c86c93fd8871fdee05bdedcea00 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Wed, 4 Dec 2024 22:27:53 +1100 Subject: [PATCH] tunables: ensure tunable and variable have same define gate If a variable is only available in the kernel, then the tunable should also only be available there. This matters very little so long as we don't have userspace tunables, but its still good hygeine. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Reviewed-by: Pavel Snajdr Signed-off-by: Rob Norris Closes #17377 --- module/zfs/arc.c | 4 +++- module/zfs/fm.c | 3 ++- module/zfs/spa_config.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 0b0f7b5a4..04ca32356 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -385,8 +385,8 @@ static int zfs_arc_overflow_shift = 8; /* log2(fraction of arc to reclaim) */ uint_t arc_shrink_shift = 7; -/* percent of pagecache to reclaim arc to */ #ifdef _KERNEL +/* percent of pagecache to reclaim arc to */ uint_t zfs_arc_pc_percent = 0; #endif @@ -11202,8 +11202,10 @@ ZFS_MODULE_PARAM_CALL(zfs_arc, zfs_arc_, grow_retry, param_set_arc_int, ZFS_MODULE_PARAM_CALL(zfs_arc, zfs_arc_, shrink_shift, param_set_arc_int, param_get_uint, ZMOD_RW, "log2(fraction of ARC to reclaim)"); +#ifdef _KERNEL ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, pc_percent, UINT, ZMOD_RW, "Percent of pagecache to reclaim ARC to"); +#endif ZFS_MODULE_PARAM(zfs_arc, zfs_arc_, average_blocksize, UINT, ZMOD_RD, "Target average block size"); diff --git a/module/zfs/fm.c b/module/zfs/fm.c index 028d9bb30..a092817ef 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -1368,7 +1368,8 @@ fm_fini(void) fm_ksp = NULL; } } -#endif /* _KERNEL */ ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, len_max, UINT, ZMOD_RW, "Max event queue length"); + +#endif /* _KERNEL */ diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c index de53de114..7d4d06659 100644 --- a/module/zfs/spa_config.c +++ b/module/zfs/spa_config.c @@ -635,5 +635,7 @@ ZFS_MODULE_PARAM(zfs_spa, spa_, config_path, STRING, ZMOD_RD, "SPA config file (/etc/zfs/zpool.cache)"); #endif +#ifdef _KERNEL ZFS_MODULE_PARAM(zfs, zfs_, autoimport_disable, INT, ZMOD_RW, "Disable pool import at module load"); +#endif