Re: [PATCH 01/19] btrfs: require at least 4 devices for RAID 6

From
H. Peter Anvin <hpa@zytor.com>
Date
2026-05-13 16:27:32
Also in
linux-arch, linux-arm-kernel, linux-btrfs, linux-crypto, linux-raid, linux-riscv, linux-s390, lkml, loongarch
Reply to
Christoph Hellwig, 2026-05-12
On May 11, 2026 10:20:41 PM PDT, Christoph Hellwig [off-list ref] wrote:
quoted hunk ↗ jump to hunk
While the RAID6 algorithm could in theory support 3 devices by just
copying the data disk to the two parity disks, this version is not only
useless because it is a suboptimal version of 3-way mirroring, but also
broken with various crashes and incorrect parity generation in various
architecture-optimized implementations.  Disallow it similar to mdraid
which requires at least 4 devices for RAID 6.

Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/volumes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a88e68f90564..0b54b97bdad8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -159,7 +159,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
		.sub_stripes	= 1,
		.dev_stripes	= 1,
		.devs_max	= 0,
-		.devs_min	= 3,
+		.devs_min	= 4,
		.tolerated_failures = 2,
		.devs_increment	= 1,
		.ncopies	= 1,
Yes, if anyone cares about < 4 disks for the RAID-6 case (or < 3 for the RAID-4/5 case), just use the RAID-1 code.
Thread (37 messages) 37 messages, 10 authors, last reply 2026-06-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help