Blame 1001-balance-mkfs-Disable-raid56-modes.patch

4ecb47
From 50ea0bbe63750dfa2700e2ad850cf8b5b418692f Mon Sep 17 00:00:00 2001
71c8ec
From: Neal Gompa <ngompa@centosproject.org>
23e2ef
Date: Wed, 1 Sep 2021 19:25:55 -0400
71c8ec
Subject: [PATCH] balance, mkfs: Disable raid56 modes
71c8ec
71c8ec
The RAID 5/6 modes in Btrfs are not yet suitable for production use,
71c8ec
so it is disabled.
71c8ec
71c8ec
Signed-off-by: Neal Gompa <ngompa@centosproject.org>
71c8ec
---
4ecb47
 cmds/balance.c | 34 ++++------------------------------
71c8ec
 mkfs/main.c    |  4 ++--
4ecb47
 2 files changed, 6 insertions(+), 32 deletions(-)
71c8ec
71c8ec
diff --git a/cmds/balance.c b/cmds/balance.c
4ecb47
index 65c7da0b..17e79211 100644
71c8ec
--- a/cmds/balance.c
71c8ec
+++ b/cmds/balance.c
4ecb47
@@ -366,7 +366,7 @@ static const char * const cmd_balance_start_usage[] = {
4ecb47
 	OPTLINE("-d[filters]", "act on data chunks with optional filters (no space in between)"),
4ecb47
 	OPTLINE("-m[filters]", "act on metadata chunks with optional filters (no space in between)"),
4ecb47
 	OPTLINE("-s[filters]", "act on system chunks (only under -f) with optional filters (no space in between)"),
4ecb47
-	OPTLINE("-f", "force a reduction of metadata integrity, or skip timeout when converting to RAID56 profiles"),
4ecb47
+	OPTLINE("-f", "force a reduction of metadata integrity"),
4ecb47
 	OPTLINE("--full-balance", "do not print warning and do not delay start"),
4ecb47
 	OPTLINE("--background|--bg", "run the balance as a background process"),
4ecb47
 	OPTLINE("--enqueue", "wait if there's another exclusive operation running, otherwise continue"),
4ecb47
@@ -387,7 +387,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
4ecb47
 	bool background = false;
71c8ec
 	bool enqueue = false;
71c8ec
 	unsigned start_flags = 0;
71c8ec
-	bool raid56_warned = false;
71c8ec
 	int i;
71c8ec
 
71c8ec
 	memset(&args, 0, sizeof(args));
4ecb47
@@ -493,8 +492,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
23e2ef
 
23e2ef
 	/* soft makes sense only when convert for corresponding type is set */
23e2ef
 	for (i = 0; ptrs[i]; i++) {
23e2ef
-		int delay = 10;
23e2ef
-
23e2ef
 		if ((ptrs[i]->flags & BTRFS_BALANCE_ARGS_SOFT) &&
23e2ef
 		    !(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) {
23e2ef
 			error("'soft' option can be used only when converting profiles");
4ecb47
@@ -504,33 +501,10 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
23e2ef
 		if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT))
71c8ec
 			continue;
71c8ec
 
ae2607
-		if (!(ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK))
71c8ec
-			continue;
71c8ec
-
71c8ec
-		if (raid56_warned)
71c8ec
-			continue;
71c8ec
-
71c8ec
-		raid56_warned = true;
71c8ec
-		printf("WARNING:\n\n");
71c8ec
-		printf("\tRAID5/6 support has known problems and is strongly discouraged\n");
71c8ec
-		printf("\tto be used besides testing or evaluation. It is recommended that\n");
71c8ec
-		printf("\tyou use one of the other RAID profiles.\n");
71c8ec
-		/*
71c8ec
-		 * Override timeout by the --force option too, though it's
71c8ec
-		 * otherwise used for allowing redundancy reduction.
71c8ec
-		 */
71c8ec
-		if (force) {
71c8ec
-			printf("\tSafety timeout skipped due to --force\n\n");
71c8ec
-			continue;
4ecb47
-		}
71c8ec
-		printf("\tThe operation will continue in %d seconds.\n", delay);
71c8ec
-		printf("\tUse Ctrl-C to stop.\n");
71c8ec
-		while (delay) {
71c8ec
-			printf("%2d", delay--);
71c8ec
-			fflush(stdout);
71c8ec
-			sleep(1);
4ecb47
+		if (ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK) {
4ecb47
+			error("RAID5/6 support has known problems and is disabled.");
4ecb47
+			return 1;
4ecb47
 		}
71c8ec
-		printf("\nStarting conversion to RAID5/6.\n");
71c8ec
 	}
71c8ec
 
71c8ec
 	if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
71c8ec
diff --git a/mkfs/main.c b/mkfs/main.c
4ecb47
index d984c995..7cb842c8 100644
71c8ec
--- a/mkfs/main.c
71c8ec
+++ b/mkfs/main.c
4ecb47
@@ -1513,8 +1513,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
ae2607
 
ae2607
 	if ((data_profile | metadata_profile) & BTRFS_BLOCK_GROUP_RAID56_MASK) {
4ecb47
 		features.incompat_flags |= BTRFS_FEATURE_INCOMPAT_RAID56;
71c8ec
-		warning("RAID5/6 support has known problems is strongly discouraged\n"
71c8ec
-			"\t to be used besides testing or evaluation.\n");
23e2ef
+		error("RAID5/6 support has known problems and is disabled.");
71c8ec
+		exit(1);
71c8ec
 	}
71c8ec
 
71c8ec
 	if ((data_profile | metadata_profile) &
71c8ec
-- 
4ecb47
2.43.0
71c8ec