btrfs-progs: use switch instead of a series of ifs for output error message
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9c3ce57e6b
commit
7cf60f4660
35
cmds-scrub.c
35
cmds-scrub.c
|
@ -1469,21 +1469,26 @@ static int scrub_start(int argc, char **argv, int resume)
|
||||||
++err;
|
++err;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sp[i].ret && sp[i].ioctl_errno == ENODEV) {
|
if (sp[i].ret) {
|
||||||
if (do_print)
|
switch (sp[i].ioctl_errno) {
|
||||||
fprintf(stderr, "WARNING: device %lld not "
|
case ENODEV:
|
||||||
"present\n", devid);
|
if (do_print)
|
||||||
continue;
|
fprintf(stderr,
|
||||||
}
|
"WARNING: device %lld not present\n",
|
||||||
if (sp[i].ret && sp[i].ioctl_errno == ECANCELED) {
|
devid);
|
||||||
++err;
|
continue;
|
||||||
} else if (sp[i].ret) {
|
case ECANCELED:
|
||||||
if (do_print)
|
++err;
|
||||||
fprintf(stderr, "ERROR: scrubbing %s failed "
|
break;
|
||||||
"for device id %lld (%s)\n", path,
|
default:
|
||||||
devid, strerror(sp[i].ioctl_errno));
|
if (do_print)
|
||||||
++err;
|
fprintf(stderr,
|
||||||
continue;
|
"ERROR: scrubbing %s failed for device id %lld (%s)\n",
|
||||||
|
path, devid,
|
||||||
|
strerror(sp[i].ioctl_errno));
|
||||||
|
++err;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sp[i].scrub_args.progress.uncorrectable_errors > 0)
|
if (sp[i].scrub_args.progress.uncorrectable_errors > 0)
|
||||||
e_uncorrectable++;
|
e_uncorrectable++;
|
||||||
|
|
Loading…
Reference in New Issue