diff options
author | NeilBrown <neilb@suse.de> | 2008-09-18 15:13:32 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-09-18 15:13:32 +1000 |
commit | 7801ac209240ca5d5159d2ab990dd8d5573e2195 (patch) | |
tree | 9eef66102669532a41150d2750c234b6cf658bfe /Assemble.c | |
parent | 9b2a22d319a85c1571c776e7059d9ca4bf1a0f0a (diff) | |
download | mdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.tar.gz mdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.tar.xz mdadm-7801ac209240ca5d5159d2ab990dd8d5573e2195.zip |
Factor out add-disk code
The variety of approaches to 'add_disk' are factored out into
a separate function, and Incremental mode benefits by being
closer to supporting the assembly of containers.
Also remove the adding-to-array-data-structure out of sysfs_add_disk
and into add_disk.
And add some tests for --incremental mode to make sure we don't break it.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -844,10 +844,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, /* Almost ready to actually *do* something */ if (!old_linux) { + struct mdinfo *sra = NULL; int rv; #ifndef MDASSEMBLE - struct mdinfo *sra = NULL; if (st->ss->external) { char ver[100]; strcat(strcpy(ver, "external:"), info.text_version); @@ -913,13 +913,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, j = chosen_drive; if (j >= 0 /* && devices[j].uptodate */) { -#ifndef MDASSEMBLE - if (st->ss->external) - rv = sysfs_add_disk(sra, &devices[j].i); - else -#endif - rv = ioctl(mdfd, ADD_NEW_DISK, - &devices[j].i.disk); + rv = add_disk(mdfd, st, sra, &devices[j].i); + if (rv) { fprintf(stderr, Name ": failed to add " "%s to %s: %s\n", |