mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-19 22:46:36 -05:00
Check and report shared physical devices across array disks
This commit is contained in:
parent
ad165dfb67
commit
30aa997947
5 changed files with 119 additions and 32 deletions
|
|
@ -3669,10 +3669,28 @@ static int device_thread(tommy_list* list, void* (*func)(void* arg))
|
|||
return 0;
|
||||
}
|
||||
|
||||
int devquery(tommy_list* high, tommy_list* low, int operation)
|
||||
void devsync(tommy_list* high)
|
||||
{
|
||||
void* (*func)(void* arg) = 0;
|
||||
#if HAVE_SYNCFS
|
||||
tommy_node* i;
|
||||
|
||||
for (i = tommy_list_head(high); i != 0; i = i->next) {
|
||||
devinfo_t* devinfo = i->data;
|
||||
int f;
|
||||
|
||||
f = open(devinfo->mount, O_RDONLY);
|
||||
if (f >= 0) {
|
||||
syncfs(f);
|
||||
close(f);
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)high;
|
||||
#endif
|
||||
}
|
||||
|
||||
int devquery(tommy_list* high, tommy_list* low)
|
||||
{
|
||||
#if HAVE_LINUX_DEVICE
|
||||
tommy_node* i;
|
||||
struct stat st;
|
||||
|
|
@ -3690,17 +3708,6 @@ int devquery(tommy_list* high, tommy_list* low, int operation)
|
|||
devinfo_t* devinfo = i->data;
|
||||
uint64_t device = devinfo->device;
|
||||
|
||||
#if HAVE_SYNCFS
|
||||
if (operation == DEVICE_DOWN) {
|
||||
/* flush the high level filesystem before spinning down */
|
||||
int f = open(devinfo->mount, O_RDONLY);
|
||||
if (f >= 0) {
|
||||
syncfs(f);
|
||||
close(f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tommy_list devlist;
|
||||
tommy_list_init(&devlist);
|
||||
|
||||
|
|
@ -3753,8 +3760,16 @@ int devquery(tommy_list* high, tommy_list* low, int operation)
|
|||
}
|
||||
#else
|
||||
(void)high;
|
||||
(void)low;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int devrun(tommy_list* low, int operation)
|
||||
{
|
||||
void* (*func)(void* arg) = 0;
|
||||
|
||||
switch (operation) {
|
||||
case DEVICE_UP : func = thread_spinup; break;
|
||||
case DEVICE_DOWN : func = thread_spindown; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue