btrfs-progs: balance: use --force to override timeout for raid56 conversions

Enhance --force to also skip the timeout, similar to what --full-balance
does. As this is only to warn about RAID56 that won't be necessary in
the future, don't add a separate option. The warning is still printed.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-03-03 16:40:53 +01:00
parent 1ed5db8db4
commit 2910ca8009
2 changed files with 19 additions and 5 deletions

View File

@ -104,6 +104,9 @@ Please note that the filters must be written together with the '-d', '-m' and
'-s' options, because they're optional and bare '-d' and '-m' also work and
mean no filters.
+
NOTE: when the target profile for conversion filter is 'raid5' or 'raid6',
there's a safety timeout of 10 seconds to warn users about the status of the feature
+
`Options`
+
-d[<filters>]::::
@ -113,7 +116,9 @@ act on metadata chunks, see `FILTERS` section for details about 'filters'
-s[<filters>]::::
act on system chunks (requires '-f'), see `FILTERS` section for details about 'filters'.
-f::::
force a reduction of metadata integrity, eg. when going from 'raid1' to 'single'
force a reduction of metadata integrity, eg. when going from 'raid1' to
'single', or skip safety timeout when the target conversion profile is 'raid5'
or 'raid6'
--background|--bg::::
run the balance operation asynchronously in the background, uses `fork`(2) to
start the process that calls the kernel ioctl

View File

@ -503,7 +503,8 @@ static const char * const cmd_balance_start_usage[] = {
"-d[filters] act on data chunks",
"-m[filters] act on metadata chunks",
"-s[filters] act on system chunks (only under -f)",
"-f force a reduction of metadata integrity",
"-f force a reduction of metadata integrity, or",
" skip timeout when converting to RAID56 profiles",
"--full-balance do not print warning and do not delay start",
"--background|--bg",
" run the balance as a background process",
@ -526,7 +527,7 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
int background = 0;
bool enqueue = false;
unsigned start_flags = 0;
bool warned = false;
bool raid56_warned = false;
int i;
memset(&args, 0, sizeof(args));
@ -648,14 +649,22 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
BTRFS_BLOCK_GROUP_RAID5)))
continue;
if (warned)
if (raid56_warned)
continue;
warned = true;
raid56_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");
/*
* Override timeout by the --force option too, though it's
* otherwise used for allowing redundancy reduction.
*/
if (force) {
printf("\tSafety timeout skipped due to --force\n\n");
continue;
}
printf("\tThe operation will continue in %d seconds.\n", delay);
printf("\tUse Ctrl-C to stop.\n");
while (delay) {