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:
Zhao Lei 2015-08-06 11:05:54 +08:00 committed by David Sterba
parent 9c3ce57e6b
commit 7cf60f4660
1 changed files with 20 additions and 15 deletions

View File

@ -1469,21 +1469,26 @@ static int scrub_start(int argc, char **argv, int resume)
++err;
continue;
}
if (sp[i].ret && sp[i].ioctl_errno == ENODEV) {
if (do_print)
fprintf(stderr, "WARNING: device %lld not "
"present\n", devid);
continue;
}
if (sp[i].ret && sp[i].ioctl_errno == ECANCELED) {
++err;
} else if (sp[i].ret) {
if (do_print)
fprintf(stderr, "ERROR: scrubbing %s failed "
"for device id %lld (%s)\n", path,
devid, strerror(sp[i].ioctl_errno));
++err;
continue;
if (sp[i].ret) {
switch (sp[i].ioctl_errno) {
case ENODEV:
if (do_print)
fprintf(stderr,
"WARNING: device %lld not present\n",
devid);
continue;
case ECANCELED:
++err;
break;
default:
if (do_print)
fprintf(stderr,
"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)
e_uncorrectable++;