Skip to content

[PW_SID:1093259] [01/19] btrfs: require at least 4 devices for RAID 6#1912

Closed
linux-riscv-bot wants to merge 20 commits into
workflow__riscv__fixesfrom
pw1093259
Closed

[PW_SID:1093259] [01/19] btrfs: require at least 4 devices for RAID 6#1912
linux-riscv-bot wants to merge 20 commits into
workflow__riscv__fixesfrom
pw1093259

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1093259 applied to workflow__riscv__fixes

Name: [01/19] btrfs: require at least 4 devices for RAID 6
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1093259
Version: 1

Linux RISC-V bot and others added 20 commits May 10, 2026 02:08
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: 53b381b ("Btrfs: RAID5 and RAID6")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Currently the raid6 code can be compiled as userspace code to run the
test suite.  Convert that to be a kunit case with minimal changes to
avoid mutating global state so that we can drop this requirement.

Note that this is not a good kunit test case yet and will need a lot more
work, but that is deferred until the raid6 code is moved to it's new
place, which is easier if the userspace makefile doesn't need adjustments
for the new location first.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
With the test code ported to kernel space, none of this is required.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move the raid6 code to live in lib/raid/ with the XOR code, and change
the internal organization so that each architecture has a subdirectory
similar to the CRC, crypto and XOR libraries, and fix up the Makefile to
only build files actually needed.

Also move the kunit test case from the history test/ subdirectory to
tests/ and use the normal naming scheme for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These are not used anywhere in the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Just open code it as in other places in the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Stop directly calling into function pointers from users of the RAID6 PQ
API, and provide exported functions with proper documentation and
API guarantees asserts where applicable instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Split out two new headers from the public pq.h:

 - lib/raid/raid6/algos.h contains the algorithm lists private to
   lib/raid/raid6
 - include/linux/raid/pq_tables.h contains the tables also used by
   async_tx providers.

The public include/linux/pq.h is now limited to the public interface for
the consumers of the RAID6 PQ API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Match the xor version with two initcalls for the built-in case to delay
calibrartion.  This prepares for adding non-calibration init code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Avoid indirect calls for P/Q parity generation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Avoid expensive indirect calls for the recovery routines as well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Drop the pointless mention of the file name, and use standard formatting
for the top of file comments.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The raid6 test combines various generation and recovery algorithms.  Use
KUNIT_CASE_PARAM and provide a generator that iterates over the possible
combinations instead of looping inside a single test instance.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use vmalloc for the data buffers instead of using static .data allocations.
This provides for better out of bounds checking and avoids wasting kernel
memory after the test has run.  vmalloc is used instead of kmalloc to
provide for better out of bounds access checking as in other kunit tests.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move the global dataptr array into test_recover() as all sites that fill
data or parity can use test_buffers directly, and this localized the
override for the failed slots to the recovery testing routine.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The current test has double-quadratic behavior in the selection for
the updated ("XORed") disks, and in the selection of updated pointers,
which makes scaling it to more tests difficult.  At the same time it
only ever tests with the maximum number of disks, which leaves a
coverage hole for smaller ones.

Fix this by randomizing the total number, failed disks and regions
to update, and increasing the upper number of tests disks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The current test has double-quadratic behavior in the selection for
the updated ("XORed") disks, and in the selection of updated pointers,
which makes scaling it to more tests difficult.  At the same time it
only ever tests with the maximum number of disks, which leaves a
coverage hole for smaller ones.

Fix this by randomizing the total number, failed disks and regions
to update, and increasing the upper number of tests disks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add code to add random alignment to the buffers to test the case where
they are not page aligned, and to move the buffers to the end of the
allocation so that they are next to the vmalloc guard page.

This does not include the recovery buffers as the recovery requires
page alignment.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 114.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1027.93 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1392.47 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.09 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
kdoc
Desc: Detects for kdoc errors
Duration: 0.74 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[01/19] btrfs: require at least 4 devices for RAID 6"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[17/19] raid6_kunit: randomize parameters and increase limits"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[17/19] raid6_kunit: randomize parameters and increase limits"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[17/19] raid6_kunit: randomize parameters and increase limits"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 114.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1033.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1391.09 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 18.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
kdoc
Desc: Detects for kdoc errors
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[18/19] raid6_kunit: randomize parameters and increase limits"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 112.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1028.56 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1390.51 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.20 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.71 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#61: FILE: lib/raid/raid6/tests/raid6_kunit.c:115:
+	KUNIT_EXPECT_MEMEQ_MSG(test, aligned_buffers[faila], dataptrs[faila],
 			len,

CHECK: Alignment should match open parenthesis
#68: FILE: lib/raid/raid6/tests/raid6_kunit.c:121:
+	KUNIT_EXPECT_MEMEQ_MSG(test, aligned_buffers[failb], dataptrs[failb],
 			len,

total: 0 errors, 0 warnings, 2 checks, 89 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 5a45994bcd4a ("raid6_kunit: randomize buffer alignment") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 2 checks, 89 lines checked
CHECK: Alignment should match open parenthesis


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
kdoc
Desc: Detects for kdoc errors
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[19/19] raid6_kunit: randomize buffer alignment"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from 2d4fcdd to cd9d421 Compare May 14, 2026 08:49
@linux-riscv-bot linux-riscv-bot deleted the pw1093259 branch May 20, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant