btrfs-progs: enhance error message with status from kernel and errno

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>
This commit is contained in:
Zhao Lei 2015-08-06 11:05:55 +08:00 committed by David Sterba
parent 7cf60f4660
commit f156ceb1b5

View 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;