aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-09-21 06:10:12 +0200
committerBrian Behlendorf <[email protected]>2018-09-20 21:10:12 -0700
commit7522a260773038ff58c213da3e722d1752655237 (patch)
treebe3eebd16484627b40f997c824d81b1c6c6d2f26 /module
parent145c88fb7bfb7e5941a0994daa3d9f4401a167a1 (diff)
Add limits to spa_slop_shift tunable
This change adds limits to the possible spa_slop_shift values set via the sysfs interface. Accepted values are from a minimum of 1 to a maximum of 31 (inclusive): these limits are based on the following values observed on a 128PB file-vdev test pool: spa_slop_shift=1, spa_get_slop_space=63.5PiB spa_slop_shift=2, spa_get_slop_space=31.8PiB spa_slop_shift=3, spa_get_slop_space=15.9PiB spa_slop_shift=4, spa_get_slop_space=7.9PiB spa_slop_shift=5, spa_get_slop_space=4PiB spa_slop_shift=6, spa_get_slop_space=2PiB ... spa_slop_shift=25, spa_get_slop_space=4GiB spa_slop_shift=26, spa_get_slop_space=2GiB spa_slop_shift=27, spa_get_slop_space=1016MiB spa_slop_shift=28, spa_get_slop_space=508MiB spa_slop_shift=29, spa_get_slop_space=254MiB spa_slop_shift=30, spa_get_slop_space=128MiB spa_slop_shift=31, spa_get_slop_space=128MiB spa_slop_shift=32, spa_get_slop_space=128MiB Reviewed-by: Richard Elling <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7876 Closes #7900
Diffstat (limited to 'module')
-rw-r--r--module/zfs/spa_misc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 2c500c010..343b01dd6 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -2553,6 +2553,26 @@ param_set_deadman_synctime(const char *val, zfs_kernel_param_t *kp)
return (0);
}
+static int
+param_set_slop_shift(const char *buf, zfs_kernel_param_t *kp)
+{
+ unsigned long val;
+ int error;
+
+ error = kstrtoul(buf, 0, &val);
+ if (error)
+ return (SET_ERROR(error));
+
+ if (val < 1 || val > 31)
+ return (SET_ERROR(-EINVAL));
+
+ error = param_set_int(buf, kp);
+ if (error < 0)
+ return (SET_ERROR(error));
+
+ return (0);
+}
+
/* Namespace manipulation */
EXPORT_SYMBOL(spa_lookup);
EXPORT_SYMBOL(spa_add);
@@ -2678,7 +2698,8 @@ module_param(spa_asize_inflation, int, 0644);
MODULE_PARM_DESC(spa_asize_inflation,
"SPA size estimate multiplication factor");
-module_param(spa_slop_shift, int, 0644);
+module_param_call(spa_slop_shift, param_set_slop_shift, param_get_int,
+ &spa_slop_shift, 0644);
MODULE_PARM_DESC(spa_slop_shift, "Reserved free space in pool");
module_param(zfs_ddt_data_is_special, int, 0644);