Adds a new smartignore option to ignore specific SMART attributes
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL / Analyze (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2025-09-15 16:56:09 +02:00
parent 4c504ab325
commit 8cef686d26
15 changed files with 211 additions and 39 deletions

View file

@ -605,7 +605,7 @@ static double raid_prob_of_one_or_more_failures(double array_failure_rate, doubl
return poisson_prob_n_or_more_failures(raid_failure_rate, 1);
}
static void state_smart(unsigned n, tommy_list* low)
static void state_smart(struct snapraid_state* state, unsigned n, tommy_list* low)
{
tommy_node* i;
unsigned j;
@ -665,6 +665,12 @@ static void state_smart(unsigned n, tommy_list* low)
double afr;
uint64_t flag;
/* clear attributes to ignore */
for (j = 0; j < SMART_IGNORE_MAX; ++j) {
devinfo->smart[state->smartignore[j]] = SMART_UNASSIGNED;
devinfo->smart[devinfo->smartignore[j]] = SMART_UNASSIGNED;
}
if (devinfo->smart[SMART_TEMPERATURE_CELSIUS] != SMART_UNASSIGNED)
printf("%7" PRIu64, devinfo->smart[SMART_TEMPERATURE_CELSIUS] & mask16);
else if (devinfo->smart[SMART_AIRFLOW_TEMPERATURE_CELSIUS] != SMART_UNASSIGNED)
@ -932,6 +938,7 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
pathcpy(entry->name, sizeof(entry->name), disk->name);
pathcpy(entry->mount, sizeof(entry->mount), disk->dir);
pathcpy(entry->smartctl, sizeof(entry->smartctl), disk->smartctl);
memcpy(entry->smartignore, disk->smartignore, sizeof(entry->smartignore));
tommy_list_insert_tail(&high, &entry->node, entry);
}
@ -951,6 +958,7 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
pathcpy(entry->name, sizeof(entry->name), lev_config_name(j));
pathcpy(entry->mount, sizeof(entry->mount), state->parity[j].split_map[s].path);
pathcpy(entry->smartctl, sizeof(entry->smartctl), state->parity[j].smartctl);
memcpy(entry->smartignore, state->parity[j].smartignore, sizeof(entry->smartignore));
pathcut(entry->mount); /* remove the parity file */
tommy_list_insert_tail(&high, &entry->node, entry);
@ -992,7 +1000,7 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
}
if (operation == DEVICE_SMART)
state_smart(state->level + tommy_list_count(&state->disklist), &low);
state_smart(state, state->level + tommy_list_count(&state->disklist), &low);
}
tommy_list_foreach(&high, free);