mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Always get the SMART info after a spinup
This commit is contained in:
parent
60bd71d184
commit
4da11411f1
3 changed files with 49 additions and 0 deletions
|
|
@ -781,6 +781,22 @@ bail:
|
|||
}
|
||||
}
|
||||
|
||||
static void state_up(struct snapraid_state* state, tommy_list* low)
|
||||
{
|
||||
tommy_node* i;
|
||||
|
||||
(void)state;
|
||||
|
||||
for (i = tommy_list_head(low); i != 0; i = i->next) {
|
||||
devinfo_t* devinfo = i->data;
|
||||
|
||||
double afr = smart_afr(devinfo->smart, devinfo->model);
|
||||
|
||||
state_info_log(devinfo);
|
||||
state_smart_log(devinfo, afr);
|
||||
}
|
||||
}
|
||||
|
||||
static void state_probe(struct snapraid_state* state, tommy_list* low)
|
||||
{
|
||||
tommy_node* i;
|
||||
|
|
@ -1034,6 +1050,9 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
|
|||
|
||||
if (operation == DEVICE_PROBE)
|
||||
state_probe(state, &low);
|
||||
|
||||
if (operation == DEVICE_UP)
|
||||
state_up(state, &low);
|
||||
}
|
||||
|
||||
tommy_list_foreach(&high, free);
|
||||
|
|
|
|||
|
|
@ -3015,6 +3015,21 @@ static void* thread_spinup(void* arg)
|
|||
|
||||
msg_status("Spunup device '%s' for disk '%s' in %" PRIu64 " ms.\n", devinfo->file, devinfo->name, tick_ms() - start);
|
||||
|
||||
/* after the spin up, get SMART info */
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->family, devinfo->model, devinfo->interf) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve some attributes directly from the system.
|
||||
*
|
||||
* smartctl intentionally skips queries on devices in standby mode
|
||||
* to prevent accidentally spinning them up.
|
||||
*/
|
||||
devattr(devinfo->device, devinfo->name, devinfo->wfile, devinfo->info, devinfo->serial, devinfo->family, devinfo->model, devinfo->interf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2023,6 +2023,21 @@ static void* thread_spinup(void* arg)
|
|||
|
||||
msg_status("Spunup device '%s' for disk '%s' in %" PRIu64 " ms.\n", devinfo->file, devinfo->name, tick_ms() - start);
|
||||
|
||||
/* after the spin up, get SMART info */
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->family, devinfo->model, devinfo->interf) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve some attributes directly from the system.
|
||||
*
|
||||
* smartctl intentionally skips queries on devices in standby mode
|
||||
* to prevent accidentally spinning them up.
|
||||
*/
|
||||
devattr(devinfo->device, devinfo->info, devinfo->serial, devinfo->family, devinfo->model, devinfo->interf);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
(void)arg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue