diff mbox

btrfs-progs: show meaningful msgs for replace cmd upon raid56

Message ID 1401933772-23447-2-git-send-email-guihc.fnst@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Gui Hecheng June 5, 2014, 2:02 a.m. UTC
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>
---
 cmds-replace.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/cmds-replace.c b/cmds-replace.c
index 9eb981b..8b18110 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -301,6 +301,10 @@  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 cannot yet handle RAID5/RAID6\n");
+
 			goto leave_with_error;
 		}