Share some code for spa deadman tunables

We need to do the same thing to update all spas on any OS for these
tunables, so let's share the code.

While here let's match the types of the literals initializing the
variables with the type of the variable.

Reviewed-by: Allan Jude <allanjude@freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #9964
This commit is contained in:
Ryan Moeller
2020-02-10 16:11:30 -05:00
committed by GitHub
parent 572b5b302a
commit 57940b435c
3 changed files with 33 additions and 19 deletions
+2 -16
View File
@@ -58,20 +58,13 @@ param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp)
int
param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp)
{
spa_t *spa = NULL;
int error;
error = param_set_ulong(val, kp);
if (error < 0)
return (SET_ERROR(error));
if (spa_mode_global != SPA_MODE_UNINIT) {
mutex_enter(&spa_namespace_lock);
while ((spa = spa_next(spa)) != NULL)
spa->spa_deadman_ziotime =
MSEC2NSEC(zfs_deadman_ziotime_ms);
mutex_exit(&spa_namespace_lock);
}
spa_set_deadman_ziotime(MSEC2NSEC(zfs_deadman_ziotime_ms));
return (0);
}
@@ -79,20 +72,13 @@ param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp)
int
param_set_deadman_synctime(const char *val, zfs_kernel_param_t *kp)
{
spa_t *spa = NULL;
int error;
error = param_set_ulong(val, kp);
if (error < 0)
return (SET_ERROR(error));
if (spa_mode_global != SPA_MODE_UNINIT) {
mutex_enter(&spa_namespace_lock);
while ((spa = spa_next(spa)) != NULL)
spa->spa_deadman_synctime =
MSEC2NSEC(zfs_deadman_synctime_ms);
mutex_exit(&spa_namespace_lock);
}
spa_set_deadman_synctime(MSEC2NSEC(zfs_deadman_synctime_ms));
return (0);
}