* [PATCH] fstests: btrfs: add a new test case for single data RAID56
@ 2026-05-24 5:08 Qu Wenruo
2026-05-25 6:17 ` Christoph Hellwig
2026-05-29 8:04 ` Zorro Lang
0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2026-05-24 5:08 UTC (permalink / raw)
To: fstests, linux-btrfs
Although single-data-RAID56, aka 2 disks raid5 or 3 disks raid6, is
not recommended for btrfs, btrfs still supports it as there are cases
like degraded writes can still lead to such cases.
But we do not have any proper tests for such corner cases.
Furthermore, RAID56 lib is going to drop the support of
single-data-RAID56, and btrfs will have its own handling of such cases,
thus coverage on single-data-RAID56 is required.
This new test case will have the following workload to verify the
behavior:
- Create a fs with single-data-RAID56
- Populate the fs with fsx and fsstress
Fsx and fsstress will utilize read and write paths of RAID56.
- Mount each device in degraded mode and run read-only scrub on them
Such scrub will utilize the following path of RAID56:
* Regular data read
* Reconstruction read
* P/Q stripe scrub
- Re-scan all devices and add a new disk to the array
- Balance all data and scrub again
This should utilized non-single-data-RAID56 handling.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
tests/btrfs/348 | 68 +++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/348.out | 2 ++
2 files changed, 70 insertions(+)
create mode 100755 tests/btrfs/348
create mode 100644 tests/btrfs/348.out
diff --git a/tests/btrfs/348 b/tests/btrfs/348
new file mode 100755
index 00000000..748e5a86
--- /dev/null
+++ b/tests/btrfs/348
@@ -0,0 +1,68 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 SUSE S.A. All Rights Reserved.
+#
+# FS QA Test 348
+#
+# Basic function test for single-data-RAID56.
+#
+. ./common/preamble
+_begin_fstest auto raid
+
+# 3 disks for single-data-raid6, but one extra to make sure btrfs can still properly
+# convert to regular 4 disks raid6.
+_require_scratch_dev_pool 4
+_require_btrfs_raid_type raid5
+_require_btrfs_raid_type raid6
+_require_btrfs_forget_or_module_loadable
+
+# Make sure we have support RAID1C34 first
+if [ ! -f "/sys/fs/btrfs/features/raid1c34" ]; then
+ _notrun "no RAID1C34 support"
+fi
+
+common_workload()
+{
+ _scratch_mount
+ _run_fsx_on_file $FSX_AVOID "$SCRATCH_MNT/foobar" -q -N 10000 >> $seqres.full
+ _run_fsstress -w -n 10000 -d "$SCRATCH_MNT"
+ _scratch_unmount
+
+ # Mount each device degraded and run a scrub to exercise:
+ # - Regular data read
+ # - Data reconstruction read
+ # - P/Q scrub
+ for dev in $SCRATCH_DEV_POOL; do
+ _btrfs_forget_or_module_reload
+
+ _mount -o ro,degraded "$dev" "$SCRATCH_MNT"
+ _btrfs scrub start -Br "$SCRATCH_MNT"
+ _scratch_unmount
+ done
+
+ # Add a new device, balance all data, and re-scrub to make sure
+ # regular RAID56 is still working.
+ _btrfs_rescan_devices
+ _spare_dev_get
+ _scratch_mount
+ _btrfs device add -f "$SPARE_DEV" "$SCRATCH_MNT"
+ _btrfs balance start -d "$SCRATCH_MNT"
+ _btrfs scrub start -B "$SCRATCH_MNT"
+ _scratch_unmount
+ _spare_dev_put
+}
+
+_scratch_dev_pool_get 2
+# There will be a warning about single-data-RAID56, thus need
+# to redirect stderr
+_scratch_pool_mkfs -m raid1 -d raid5 >> $seqres.full 2>&1
+common_workload
+_scratch_dev_pool_put
+
+_scratch_dev_pool_get 3
+_scratch_pool_mkfs -m raid1c3 -d raid6 >> $seqres.full 2>&1
+common_workload
+_scratch_dev_pool_put
+
+echo "Silence is golden"
+_exit 0
diff --git a/tests/btrfs/348.out b/tests/btrfs/348.out
new file mode 100644
index 00000000..ec5e4701
--- /dev/null
+++ b/tests/btrfs/348.out
@@ -0,0 +1,2 @@
+QA output created by 348
+Silence is golden
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fstests: btrfs: add a new test case for single data RAID56
2026-05-24 5:08 [PATCH] fstests: btrfs: add a new test case for single data RAID56 Qu Wenruo
@ 2026-05-25 6:17 ` Christoph Hellwig
2026-05-29 8:04 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-05-25 6:17 UTC (permalink / raw)
To: Qu Wenruo; +Cc: fstests, linux-btrfs
Looks good to me:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fstests: btrfs: add a new test case for single data RAID56
2026-05-24 5:08 [PATCH] fstests: btrfs: add a new test case for single data RAID56 Qu Wenruo
2026-05-25 6:17 ` Christoph Hellwig
@ 2026-05-29 8:04 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: Zorro Lang @ 2026-05-29 8:04 UTC (permalink / raw)
To: Qu Wenruo; +Cc: fstests, linux-btrfs
On Sun, May 24, 2026 at 02:38:48PM +0930, Qu Wenruo wrote:
> Although single-data-RAID56, aka 2 disks raid5 or 3 disks raid6, is
> not recommended for btrfs, btrfs still supports it as there are cases
> like degraded writes can still lead to such cases.
>
> But we do not have any proper tests for such corner cases.
>
> Furthermore, RAID56 lib is going to drop the support of
> single-data-RAID56, and btrfs will have its own handling of such cases,
> thus coverage on single-data-RAID56 is required.
>
> This new test case will have the following workload to verify the
> behavior:
>
> - Create a fs with single-data-RAID56
>
> - Populate the fs with fsx and fsstress
> Fsx and fsstress will utilize read and write paths of RAID56.
>
> - Mount each device in degraded mode and run read-only scrub on them
> Such scrub will utilize the following path of RAID56:
> * Regular data read
> * Reconstruction read
> * P/Q stripe scrub
>
> - Re-scan all devices and add a new disk to the array
> - Balance all data and scrub again
> This should utilized non-single-data-RAID56 handling.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
This test case is highly standardized and complete! Thanks
Reviewed-by: Zorro Lang <zlang@kernel.org>
> tests/btrfs/348 | 68 +++++++++++++++++++++++++++++++++++++++++++++
> tests/btrfs/348.out | 2 ++
> 2 files changed, 70 insertions(+)
> create mode 100755 tests/btrfs/348
> create mode 100644 tests/btrfs/348.out
>
> diff --git a/tests/btrfs/348 b/tests/btrfs/348
> new file mode 100755
> index 00000000..748e5a86
> --- /dev/null
> +++ b/tests/btrfs/348
> @@ -0,0 +1,68 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 SUSE S.A. All Rights Reserved.
> +#
> +# FS QA Test 348
> +#
> +# Basic function test for single-data-RAID56.
> +#
> +. ./common/preamble
> +_begin_fstest auto raid
> +
> +# 3 disks for single-data-raid6, but one extra to make sure btrfs can still properly
> +# convert to regular 4 disks raid6.
> +_require_scratch_dev_pool 4
> +_require_btrfs_raid_type raid5
> +_require_btrfs_raid_type raid6
> +_require_btrfs_forget_or_module_loadable
> +
> +# Make sure we have support RAID1C34 first
> +if [ ! -f "/sys/fs/btrfs/features/raid1c34" ]; then
> + _notrun "no RAID1C34 support"
> +fi
> +
> +common_workload()
> +{
> + _scratch_mount
> + _run_fsx_on_file $FSX_AVOID "$SCRATCH_MNT/foobar" -q -N 10000 >> $seqres.full
> + _run_fsstress -w -n 10000 -d "$SCRATCH_MNT"
> + _scratch_unmount
> +
> + # Mount each device degraded and run a scrub to exercise:
> + # - Regular data read
> + # - Data reconstruction read
> + # - P/Q scrub
> + for dev in $SCRATCH_DEV_POOL; do
> + _btrfs_forget_or_module_reload
> +
> + _mount -o ro,degraded "$dev" "$SCRATCH_MNT"
> + _btrfs scrub start -Br "$SCRATCH_MNT"
> + _scratch_unmount
> + done
> +
> + # Add a new device, balance all data, and re-scrub to make sure
> + # regular RAID56 is still working.
> + _btrfs_rescan_devices
> + _spare_dev_get
> + _scratch_mount
> + _btrfs device add -f "$SPARE_DEV" "$SCRATCH_MNT"
> + _btrfs balance start -d "$SCRATCH_MNT"
> + _btrfs scrub start -B "$SCRATCH_MNT"
> + _scratch_unmount
> + _spare_dev_put
> +}
> +
> +_scratch_dev_pool_get 2
> +# There will be a warning about single-data-RAID56, thus need
> +# to redirect stderr
> +_scratch_pool_mkfs -m raid1 -d raid5 >> $seqres.full 2>&1
> +common_workload
> +_scratch_dev_pool_put
> +
> +_scratch_dev_pool_get 3
> +_scratch_pool_mkfs -m raid1c3 -d raid6 >> $seqres.full 2>&1
> +common_workload
> +_scratch_dev_pool_put
> +
> +echo "Silence is golden"
> +_exit 0
> diff --git a/tests/btrfs/348.out b/tests/btrfs/348.out
> new file mode 100644
> index 00000000..ec5e4701
> --- /dev/null
> +++ b/tests/btrfs/348.out
> @@ -0,0 +1,2 @@
> +QA output created by 348
> +Silence is golden
> --
> 2.51.2
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-29 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-24 5:08 [PATCH] fstests: btrfs: add a new test case for single data RAID56 Qu Wenruo
2026-05-25 6:17 ` Christoph Hellwig
2026-05-29 8:04 ` Zorro Lang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.