From 6c1421f5a09a8a0a53ba09bc46550c8621851a00 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 17 Oct 2025 09:12:21 +0200 Subject: [PATCH] Change thermal defaults --- HISTORY | 2 +- cmdline/state.c | 4 ++-- cmdline/thermal.c | 23 +++++++++-------------- cmdline/thermal.h | 2 +- snapraid.1 | 2 +- snapraid.d | 2 +- snapraid.txt | 2 +- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/HISTORY b/HISTORY index 5df3a7d5..a44e6834 100644 --- a/HISTORY +++ b/HISTORY @@ -10,7 +10,7 @@ SnapRAID HISTORY overheating. - temp_sleep TIME_IN_MINUTES Defines how long the disks remain in standby after a temperature limit - event. After this time, operations are resumed. Defaults to 15 minutes. + event. After this time, operations are resumed. Defaults to 5 minutes. * Add a new "probe" command that shows the spinning status of all disks. * Add a new -s, --spin-down-on-error option that spins down all disks when a command ends with an error. diff --git a/cmdline/state.c b/cmdline/state.c index c78cd4da..f423a054 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -1193,9 +1193,9 @@ void state_config(struct snapraid_state* state, const char* path, const char* co exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ } - if (time < 5 || time > 120) { + if (time < 3 || time > 120) { /* LCOV_EXCL_START */ - log_fatal("Invalid 'temp_sleep' temperature specification in '%s' at line %u. It must be between 5 and 120\n", path, line); + log_fatal("Invalid 'temp_sleep' temperature specification in '%s' at line %u. It must be between 3 and 120\n", path, line); exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ } diff --git a/cmdline/thermal.c b/cmdline/thermal.c index 3cd48c29..31583928 100644 --- a/cmdline/thermal.c +++ b/cmdline/thermal.c @@ -51,8 +51,8 @@ struct snapraid_thermal_params fit_thermal_model(const struct snapraid_thermal_p model.t_ambient = t_ambient; - /* at least three points to have a result */ - if (n_points < 3) + /* at least four points to have a result */ + if (n_points < 4) return model; double last_temp = points[n_points - 1].temperature; @@ -220,7 +220,6 @@ void state_thermal(struct snapraid_state* state, time_t now) struct snapraid_thermal* found; devinfo_t* devinfo = i->data; unsigned k; - unsigned count; int temperature = smart_temp(devinfo); if (temperature < 0) @@ -255,27 +254,23 @@ void state_thermal(struct snapraid_state* state, time_t now) if (found->count + 1 >= THERMAL_MAX) /* keep one extra space at the end */ continue; - /* only monotone temperature */ - if (found->count > 0 && found->data[found->count - 1].temperature > temperature) + /* only monotone increasing temperature */ + if (found->count > 0 && found->data[found->count - 1].temperature >= temperature) continue; /* insert the new data point */ found->data[found->count].temperature = temperature; found->data[found->count].time = now - state->thermal_first; - - /* if it's a new temperature, store it, otherwise have it ovewritten the next time */ - count = found->count + 1; - if (found->count == 0 || found->data[found->count - 1].temperature < temperature) - found->count = count; + ++found->count; /* log the new data */ - log_tag("thermal:heat:%s:%" PRIu64 ":%u:", devinfo->name, devinfo->device, count); - for (k = 0; k < count; ++k) + log_tag("thermal:heat:%s:%" PRIu64 ":%u:", devinfo->name, devinfo->device, found->count); + for (k = 0; k < found->count; ++k) log_tag("%s%d/%d", k > 0 ? "," : "", (int)found->data[k].temperature, (int)found->data[k].time); log_tag("\n"); /* estimate parameters */ - found->params = fit_thermal_model(found->data, count, state->thermal_ambient_temperature); + found->params = fit_thermal_model(found->data, found->count, state->thermal_ambient_temperature); log_tag("thermal:params:%s:%" PRIu64 ":%g:%g:%g:%g:%g:%g\n", devinfo->name, devinfo->device, found->params.k_heat, found->params.t_ambient, found->params.t_steady, @@ -309,7 +304,7 @@ void state_thermal_cooldown(struct snapraid_state* state) unsigned sleep_time = state->thermal_cooldown_time; if (sleep_time == 0) - sleep_time = 15 * 60; /* default sleep time */ + sleep_time = 5 * 60; /* default sleep time */ if (sleep_time < 5 * 60) sleep_time = 5 * 60; /* minimum sleep time */ diff --git a/cmdline/thermal.h b/cmdline/thermal.h index e7d950d2..5a6cf76a 100644 --- a/cmdline/thermal.h +++ b/cmdline/thermal.h @@ -26,7 +26,7 @@ /** * Period of temperature measures */ -#define THERMAL_PERIOD_SECONDS 60 +#define THERMAL_PERIOD_SECONDS 30 /** * Max number of temperature measures diff --git a/snapraid.1 b/snapraid.1 index c852d135..55fda0f6 100644 --- a/snapraid.1 +++ b/snapraid.1 @@ -1521,7 +1521,7 @@ To display the temperature of all disks, use the \-A or \-\-stats option. .SS temp_sleep TIME_IN_MINUTES Sets the standby time, in minutes, when the temperature limit is reached. During this period, the disks remain spun down. The default -is 15 minutes. +is 5 minutes. .SS pool DIR Defines the pooling directory where the virtual view of the disk array is created using the \[dq]pool\[dq] command. diff --git a/snapraid.d b/snapraid.d index 86d65ee0..7aac8e13 100644 --- a/snapraid.d +++ b/snapraid.d @@ -1230,7 +1230,7 @@ Configuration temp_sleep TIME_IN_MINUTES Sets the standby time, in minutes, when the temperature limit is reached. During this period, the disks remain spun down. The default - is 15 minutes. + is 5 minutes. pool DIR Defines the pooling directory where the virtual view of the disk diff --git a/snapraid.txt b/snapraid.txt index 9f43d893..5074bb27 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -1316,7 +1316,7 @@ To display the temperature of all disks, use the -A or --stats option. Sets the standby time, in minutes, when the temperature limit is reached. During this period, the disks remain spun down. The default -is 15 minutes. +is 5 minutes. 7.13 pool DIR -------------