btrfs-progs: show meaningful msgs for replace cmd upon raid56
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>
Thu, 5 Jun 2014 02:02:52 +0000 (10:02 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 22 Aug 2014 12:41:15 +0000 (14:41 +0200)
This depends on the kernel patch:
[PATCH] btrfs:replace EINVAL with EOPNOTSUPP for dev_replace

This catches the EOPNOTSUPP and output msg that says dev_replace raid56
is not currently supported. Note that the msg will only be shown when
run dev_replace not in background.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-replace.c

index 186a127..9fe7ad8 100644 (file)
@@ -308,6 +308,11 @@ static int cmd_start_replace(int argc, char **argv)
                                "ERROR: ioctl(DEV_REPLACE_START) failed on \"%s\": %s, %s\n",
                                path, strerror(errno),
                                replace_dev_result2string(start_args.result));
+
+                       if (errno == EOPNOTSUPP)
+                               fprintf(stderr,
+                                       "WARNING: dev_replace does not yet handle RAID5/6\n");
+
                        goto leave_with_error;
                }