@@ -1109,7 +1109,6 @@ static int scrub_start(int argc, char **argv, int resume)
int print_raw = 0;
char *path;
int do_background = 1;
- int do_wait = 0;
int do_print = 0;
int do_quiet = 0;
int do_record = 1;
@@ -1147,7 +1146,6 @@ static int scrub_start(int argc, char **argv, int resume)
switch (c) {
case 'B':
do_background = 0;
- do_wait = 1;
do_print = 1;
break;
case 'd':
@@ -1374,28 +1372,11 @@ static int scrub_start(int argc, char **argv, int resume)
}
if (pid) {
- int stat;
scrub_handle_sigint_parent();
if (!do_quiet)
printf("scrub %s on %s, fsid %s (pid=%d)\n",
n_start ? "started" : "resumed",
path, fsid, pid);
- if (!do_wait) {
- err = 0;
- goto out;
- }
- ret = wait(&stat);
- if (ret != pid) {
- error_on(!do_quiet, "wait failed (ret=%d): %m",
- ret);
- err = 1;
- goto out;
- }
- if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
- error_on(!do_quiet, "scrub process failed");
- err = WIFEXITED(stat) ? WEXITSTATUS(stat) : -1;
- goto out;
- }
err = 0;
goto out;
}
Variable do_wait is synchronized with the variable do_background, when if(do_background) is true, if(!do_wait) is also true, so parent process will goto out immediately. The following wait never be run. And if option -B is chosen, when do_background is 0 and do_wait is 1, there is no need to fork a child process to wait for scrub over. So remove unnecessary process. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> --- cmds-scrub.c | 19 ------------------- 1 file changed, 19 deletions(-)