* [PATCH] btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56
@ 2014-06-05 2:02 Gui Hecheng
2014-06-05 2:02 ` [PATCH] btrfs-progs: show meaningful msgs for replace cmd upon raid56 Gui Hecheng
0 siblings, 1 reply; 2+ messages in thread
From: Gui Hecheng @ 2014-06-05 2:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: Gui Hecheng
To return EOPNOTSUPP is more user friendly than to return EINVAL,
and then user-space tool will show that the dev_replace operation
for raid56 is not currently supported rather than showing that
there is an invalid argument.
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
fs/btrfs/dev-replace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 9f22905..2af6e66 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -313,7 +313,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
if (btrfs_fs_incompat(fs_info, RAID56)) {
btrfs_warn(fs_info, "dev_replace cannot yet handle RAID5/RAID6");
- return -EINVAL;
+ return -EOPNOTSUPP;
}
switch (args->start.cont_reading_from_srcdev_mode) {
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] btrfs-progs: show meaningful msgs for replace cmd upon raid56
2014-06-05 2:02 [PATCH] btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56 Gui Hecheng
@ 2014-06-05 2:02 ` Gui Hecheng
0 siblings, 0 replies; 2+ messages in thread
From: Gui Hecheng @ 2014-06-05 2:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: Gui Hecheng
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 --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;
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-05 2:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05 2:02 [PATCH] btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56 Gui Hecheng
2014-06-05 2:02 ` [PATCH] btrfs-progs: show meaningful msgs for replace cmd upon raid56 Gui Hecheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).