build: add ZFS_DEBUG Kconfig for copy-builtin
checkstyle / checkstyle (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
smatch / smatch (push) Has been cancelled
zfs-arm / ZFS ARM build (push) Has been cancelled
zfs-qemu / Setup (push) Has been cancelled
zloop / zloop (push) Has been cancelled
zfs-qemu / qemu-x86 (push) Has been cancelled
zfs-qemu / Cleanup (push) Has been cancelled

... so we can toggle ZFS debug assertions from the
Linux kernel build without having to regenerate the
ZFS patch.

Update the qemu test script to also set this kernel
config.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Timothy Day <timday@thelustrecollective.com>
Co-authored-by: Timothy Day <timday@thelustrecollective.com>
Closes #18595
This commit is contained in:
Timothy Day
2026-05-29 16:40:14 +00:00
committed by GitHub
parent ec65e4b6bb
commit eafa39fbc3
4 changed files with 33 additions and 2 deletions
@@ -79,6 +79,7 @@ function do_builtin_build() {
cd $HOME/linux-$fullver
./scripts/config --enable ZFS
./scripts/config --enable ZFS_DEBUG
yes "" | make oldconfig
make -j `nproc`
) &> /var/tmp/builtin.txt || rc=$?
+12
View File
@@ -39,6 +39,18 @@ dnl # (If INVARIANTS is detected, we need to force DEBUG, or strange panics
dnl # can ensue.)
dnl #
AC_DEFUN([ZFS_AC_DEBUG], [
dnl #
dnl # In the Linux kernel copy-builtin build, assertion/debug support
dnl # is selected by CONFIG_ZFS_DEBUG (Kconfig).
dnl #
AH_BOTTOM([
#ifdef CONFIG_ZFS
#undef ZFS_DEBUG
#ifdef CONFIG_ZFS_DEBUG
#define ZFS_DEBUG 1
#endif
#endif])
AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
+11
View File
@@ -43,6 +43,17 @@ config ZFS
To compile this file system support as a module, choose M here.
If unsure, say N.
config ZFS_DEBUG
bool "ZFS debugging"
depends on ZFS
help
Enable ZFS debugging. This turns on all ASSERT() assertions,
enables additional debug-only code paths, and promotes
compiler warnings to errors. This should only be enabled for
development or troubleshooting.
If unsure, say N.
EOF
+9 -2
View File
@@ -4,9 +4,11 @@
ZFS_MODULE_CFLAGS += -std=gnu11 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @KERNEL_NO_FORMAT_ZERO_LENGTH@
ZFS_MODULE_CFLAGS += @KERNEL_NO_FORMAT_ZERO_LENGTH@
ifneq ($(KBUILD_EXTMOD),)
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
zfs_include = @abs_top_srcdir@/include
icp_include = @abs_srcdir@/icp/include
zstd_include = @abs_srcdir@/zstd/include
@@ -16,6 +18,12 @@ ZFS_MODULE_CFLAGS += -I@abs_top_builddir@/include
src = @abs_srcdir@
obj = @abs_builddir@
else
ifeq ($(CONFIG_ZFS_DEBUG),y)
ZFS_MODULE_CFLAGS += -Werror
ZFS_MODULE_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
else
ZFS_MODULE_CPPFLAGS += -UDEBUG -DNDEBUG
endif
zfs_include = $(srctree)/include/zfs
icp_include = $(src)/icp/include
zstd_include = $(src)/zstd/include
@@ -28,7 +36,6 @@ ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/spl
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/zfs
ZFS_MODULE_CFLAGS += -I$(zfs_include)
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
# KASAN enables -Werror=frame-larger-than=1024, which
# breaks oh so many parts of our build.