mirror of https://github.com/openzfs/zfs.git
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:
parent
572b5b302a
commit
57940b435c
|
@ -445,6 +445,8 @@ extern sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl,
|
|||
const char *name);
|
||||
extern void spa_event_post(sysevent_t *ev);
|
||||
extern int param_set_deadman_failmode_common(const char *val);
|
||||
extern void spa_set_deadman_synctime(hrtime_t ns);
|
||||
extern void spa_set_deadman_ziotime(hrtime_t ns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -303,20 +303,20 @@ int zfs_free_leak_on_eio = B_FALSE;
|
|||
* has not completed in zfs_deadman_synctime_ms is considered "hung" resulting
|
||||
* in one of three behaviors controlled by zfs_deadman_failmode.
|
||||
*/
|
||||
unsigned long zfs_deadman_synctime_ms = 600000ULL;
|
||||
unsigned long zfs_deadman_synctime_ms = 600000UL;
|
||||
|
||||
/*
|
||||
* This value controls the maximum amount of time zio_wait() will block for an
|
||||
* outstanding IO. By default this is 300 seconds at which point the "hung"
|
||||
* behavior will be applied as described for zfs_deadman_synctime_ms.
|
||||
*/
|
||||
unsigned long zfs_deadman_ziotime_ms = 300000ULL;
|
||||
unsigned long zfs_deadman_ziotime_ms = 300000UL;
|
||||
|
||||
/*
|
||||
* Check time in milliseconds. This defines the frequency at which we check
|
||||
* for hung I/O.
|
||||
*/
|
||||
unsigned long zfs_deadman_checktime_ms = 60000ULL;
|
||||
unsigned long zfs_deadman_checktime_ms = 60000UL;
|
||||
|
||||
/*
|
||||
* By default the deadman is enabled.
|
||||
|
@ -1999,6 +1999,32 @@ spa_set_deadman_failmode(spa_t *spa, const char *failmode)
|
|||
spa->spa_deadman_failmode = ZIO_FAILURE_MODE_WAIT;
|
||||
}
|
||||
|
||||
void
|
||||
spa_set_deadman_ziotime(hrtime_t ns)
|
||||
{
|
||||
spa_t *spa = NULL;
|
||||
|
||||
if (spa_mode_global != SPA_MODE_UNINIT) {
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
while ((spa = spa_next(spa)) != NULL)
|
||||
spa->spa_deadman_ziotime = ns;
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spa_set_deadman_synctime(hrtime_t ns)
|
||||
{
|
||||
spa_t *spa = NULL;
|
||||
|
||||
if (spa_mode_global != SPA_MODE_UNINIT) {
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
while ((spa = spa_next(spa)) != NULL)
|
||||
spa->spa_deadman_synctime = ns;
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
dva_get_dsize_sync(spa_t *spa, const dva_t *dva)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue