Map devices before starting thermal

This commit is contained in:
Andrea Mazzoleni 2026-09-03 20:06:49 +02:00
parent 93a64a3710
commit 930f0dbbcb
3 changed files with 18 additions and 6 deletions

View file

@ -1082,6 +1082,15 @@ int devtest(tommy_list* high, tommy_list* low, int operation)
return 0;
}
void state_devmap(struct snapraid_state* state)
{
/* map device if not already done */
if (!state->mapped_device) {
devmap();
state->mapped_device = 1;
}
}
int state_device(struct snapraid_state* state, int operation, tommy_list* filterlist_disk)
{
tommy_node* i;
@ -1091,17 +1100,13 @@ int state_device(struct snapraid_state* state, int operation, tommy_list* filter
int ret;
time_t now = time(0);
/* map device if not already done */
if (!state->mapped_device) {
devmap();
state->mapped_device = 1;
}
switch (operation) {
case DEVICE_UP : msg_progress("Spinup...\n"); break;
case DEVICE_DOWN : msg_progress("Spindown...\n"); break;
}
state_devmap(state);
tommy_list_init(&high);
tommy_list_init(&low);

View file

@ -253,6 +253,11 @@ void state_scan(struct snapraid_state* state);
*/
void state_touch(struct snapraid_state* state);
/**
* Map devices if not already done.
*/
void state_devmap(struct snapraid_state* state);
/**
* Devices operations.
*/

View file

@ -128,6 +128,8 @@ void state_thermal(struct snapraid_state* state, time_t now)
if (state->thermal_temperature_limit == 0)
return;
state_devmap(state);
tommy_list_init(&high);
tommy_list_init(&low);