reshape_array: move lots of code out of a 'switch'.
Everything other than the 'child' part of the 'switch(fork)' returns quickly, so leave them inside the switch but move the other large bit out so as to make the flow of code more natural. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
9202b8eb6a
commit
6b2d630c7d
24
Grow.c
24
Grow.c
|
@ -1921,7 +1921,18 @@ static int reshape_array(char *container, int fd, char *devname,
|
|||
* This is all done by a forked background process.
|
||||
*/
|
||||
switch(forked ? 0 : fork()) {
|
||||
case -1:
|
||||
fprintf(stderr, Name ": Cannot run child to monitor reshape: %s\n",
|
||||
strerror(errno));
|
||||
rv = 1;
|
||||
abort_reshape(sra);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
if (check_env("MDADM_GROW_VERIFY"))
|
||||
fd = open(devname, O_RDONLY | O_DIRECT);
|
||||
|
@ -2009,21 +2020,12 @@ static int reshape_array(char *container, int fd, char *devname,
|
|||
": %s: could not set level "
|
||||
"to %s\n", devname, c);
|
||||
}
|
||||
out:
|
||||
out:
|
||||
if (forked)
|
||||
return 0;
|
||||
exit(0);
|
||||
case -1:
|
||||
fprintf(stderr, Name ": Cannot run child to monitor reshape: %s\n",
|
||||
strerror(errno));
|
||||
rv = 1;
|
||||
abort_reshape(sra);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
release:
|
||||
release:
|
||||
if (!rv) {
|
||||
if (container)
|
||||
ping_monitor(container);
|
||||
|
|
Loading…
Reference in New Issue