From 39893bb15ef39ee2ed254d931faf9c67d6c47e37 Mon Sep 17 00:00:00 2001 From: Eryu Guan Date: Fri, 10 Oct 2014 21:16:16 +0800 Subject: btrfs-progs: only report internal dev replace result if there's a result If BTRFS_IOC_DEV_REPLACE ioctl failed, args.result usually won't be updated by the ioctl. And the arg has been initialized with 0, the result is always 0, which is BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR, and the resulting error message looks confusing: ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": No such file or directory, no error But in case there's an internal result returned in future, don't drop the result completely, instead print dev replace result message only if the result is updated by a failed ioctl call. Signed-off-by: Eryu Guan Signed-off-by: David Sterba --- ioctl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'ioctl.h') diff --git a/ioctl.h b/ioctl.h index f0fc0608..df9e4b7a 100644 --- a/ioctl.h +++ b/ioctl.h @@ -141,6 +141,7 @@ struct btrfs_ioctl_dev_replace_status_params { #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2 +#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT -1 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2 -- cgit v1.2.3