diff --git a/cmds/balance.c b/cmds/balance.c index c444a58c..e71a2639 100644 --- a/cmds/balance.c +++ b/cmds/balance.c @@ -526,6 +526,7 @@ static int cmd_balance_start(const struct cmd_struct *cmd, int background = 0; bool enqueue = false; unsigned start_flags = 0; + bool warned = false; int i; memset(&args, 0, sizeof(args)); @@ -632,11 +633,37 @@ static int cmd_balance_start(const struct cmd_struct *cmd, /* soft makes sense only when convert for corresponding type is set */ for (i = 0; ptrs[i]; i++) { + int delay = 10; + if ((ptrs[i]->flags & BTRFS_BALANCE_ARGS_SOFT) && !(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) { error("'soft' option can be used only when converting profiles"); return 1; } + + if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) + continue; + + if (!(ptrs[i]->flags & (BTRFS_BLOCK_GROUP_RAID6 | + BTRFS_BLOCK_GROUP_RAID5))) + continue; + + if (warned) + continue; + + warned = true; + printf("WARNING:\n\n"); + printf("\tRAID5/6 support has known problems and is strongly discouraged\n"); + printf("\tto be used besides testing or evaluation. It is recommended that\n"); + printf("\tyou use one of the other RAID profiles.\n"); + printf("\tThe operation will continue in %d seconds.\n", delay); + printf("\tUse Ctrl-C to stop.\n"); + while (delay) { + printf("%2d", delay--); + fflush(stdout); + sleep(1); + } + printf("\nStarting conversion to RAID5/6.\n"); } if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {