summaryrefslogtreecommitdiff
path: root/Manage.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-03-22 16:15:03 +1100
committerNeilBrown <neilb@suse.de>2012-03-22 16:15:03 +1100
commit9f58469128c99c0d7f434d28657f86789334f253 (patch)
tree601d5ce6439f9d2fc59a2cb2f8999d6707ada720 /Manage.c
parentbcbb3112d2801594358153956191e4cff6021de3 (diff)
Manage: freeze recovery while adding multiple devices.
If the kernel supports it, freeze recovery over multiple adds, so that they can all be added to the array at the same time and be recovered in parallel. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Manage.c b/Manage.c
index f53fe276..7deba3aa 100644
--- a/Manage.c
+++ b/Manage.c
@@ -416,12 +416,15 @@ int Manage_subdevs(char *devname, int fd,
int lfd = -1;
int sysfd = -1;
int count = 0; /* number of actions taken */
+ struct mdinfo info;
+ int frozen = 0;
if (ioctl(fd, GET_ARRAY_INFO, &array)) {
fprintf(stderr, Name ": cannot get array info for %s\n",
devname);
goto abort;
}
+ sysfs_init(&info, fd, 0);
/* array.size is only 32 bit and may be truncated.
* So read from sysfs if possible, and record number of sectors
@@ -629,6 +632,12 @@ int Manage_subdevs(char *devname, int fd,
dv->devname, strerror(errno));
goto abort;
}
+ if (!frozen) {
+ if (sysfs_freeze_array(&info) == 1)
+ frozen = 1;
+ else
+ frozen = -1;
+ }
st = dup_super(tst);
@@ -1166,11 +1175,15 @@ int Manage_subdevs(char *devname, int fd,
break;
}
}
+ if (frozen > 0)
+ sysfs_set_str(&info, NULL, "sync_action","idle");
if (test && count == 0)
return 2;
return 0;
abort:
+ if (frozen > 0)
+ sysfs_set_str(&info, NULL, "sync_action","idle");
return 1;
}