btrfs-progs: enhance error message with status from kernel and errno
authorZhao Lei <zhaolei@cn.fujitsu.com>
Thu, 6 Aug 2015 03:05:55 +0000 (11:05 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Oct 2015 09:48:24 +0000 (11:48 +0200)
Scrub output prints the following error message in my test:
  ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5 (Success)

It is caused by a broken kernel and fs, but the we need to avoid
printing both "error and success" on one line as above.

This patch modified above message to:
  ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5: ret=1, errno=0 (Success)

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[minor updates in formatting]
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-scrub.c

index 1c3fc03..f2611a0 100644 (file)
@@ -1483,8 +1483,9 @@ static int scrub_start(int argc, char **argv, int resume)
                        default:
                                if (do_print)
                                        fprintf(stderr,
-                       "ERROR: scrubbing %s failed for device id %lld (%s)\n",
+       "ERROR: scrubbing %s failed for device id %lld: ret=%d, errno=%d (%s)\n",
                                                path, devid,
+                                               sp[i].ret, sp[i].ioctl_errno,
                                                strerror(sp[i].ioctl_errno));
                                ++err;
                                continue;