mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 23:16:28 -05:00
When spinning down sync only the related disks
This commit is contained in:
parent
524733a6db
commit
3678474074
2 changed files with 12 additions and 6 deletions
|
|
@ -1860,11 +1860,6 @@ int devquery(tommy_list* high, tommy_list* low, int operation, int others)
|
|||
{
|
||||
void* (*func)(void* arg) = 0;
|
||||
|
||||
if (operation == DEVICE_DOWN) {
|
||||
/* flush all the disk caches before spinning down */
|
||||
sync();
|
||||
}
|
||||
|
||||
#if HAVE_LINUX_DEVICE
|
||||
tommy_node* i;
|
||||
struct stat st;
|
||||
|
|
@ -1883,6 +1878,17 @@ int devquery(tommy_list* high, tommy_list* low, int operation, int others)
|
|||
uint64_t device = devinfo->device;
|
||||
uint64_t access_stat;
|
||||
|
||||
#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
|
||||
|
||||
/* if the major is the null device, find the real one */
|
||||
if (major(device) == 0) {
|
||||
/* obtain the real device */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue