Use these notes for day-to-day changes. Consult .github/CONTRIBUTING.md for PR, commit and detailed style requirements.
module/ code targets Linux, FreeBSD and userspace libzpool. Keep native kernel APIs in module/os/{linux,freebsd} and use portability interfaces from include/os/ and lib/libspl/include/os/.config/kernel-*.m4 feature checks; kernel version checks alone miss distribution backports.CONTRIBUTING.md and .editorconfig: tabs, 80 columns, 4-space continuations, return (x), one declaration per line.ASSERT* disappears without debug; VERIFY* remains. Never put required side effects in ASSERT. Validate user input and corrupt disk data with errors, not assertions that can panic the host.kmem_*, vmem_* and kmem_cache_*, not bare malloc in common kernel code. KM_SLEEP requires a context that permits sleeping; justify KM_NOSLEEP and handle allocation failure.sys/zfs_context.h locks and task queues so common code builds in libzpool. Preserve lock order, ownership and reference lifetimes on error paths too. Comment only non-obvious invariants and reasons, briefly.void *.ZFS_MODULE_PARAM; follow existing platform mechanisms elsewhere. Document new parameters in man/man4/zfs.4.scripts/spdxcheck.pl for license tags; preserve third-party licenses and keep script shebangs first. Follow the component's update process for vendored Lua, zstd and cryptographic code; avoid unrelated changes there.Use a disposable VM for module reloads and ZTS, never a host with live ZFS pools. zfs.sh -r replaces the module stack; ZTS creates and destroys pools, devices and mounts. $DISKS may be overwritten without confirmation, and zfs-tests.sh -x destroys every pool whose name contains testpool. Confirm disposable devices and the test environment if uncertain.
zloop.sh, ztest and unit tests run in userspace, but zloop.sh deletes its working directory and may change system core-dump settings. Use dedicated scratch directories and minimal privileges.
./autogen.sh && ./configure --enable-debug && make -j$(nproc) make checkstyle make unit # T=<name> selects one binary sudo ./scripts/zfs.sh -r # disposable VM only sudo ./scripts/zfs-tests.sh -t <test_name> # disposable VM only zfs_source_dir=$(pwd -P) zfs_scratch_dir=$(mktemp -d /var/tmp/zfs-zloop.XXXXXX) || exit 1 ( cd "$zfs_scratch_dir" || exit 1 "$zfs_source_dir/scripts/zloop.sh" -t 600 \ -f "$zfs_scratch_dir" -c "$zfs_scratch_dir/cores" )
make checkstyle must pass; do not bypass cstyle with exclusions. Report actual platforms/tests, missing tools and skipped checks.vcscheck rejects untracked files: stage intended additions, and remove only scratch files you created.git archive HEAD omits them.include/zfeature_common.h, register it in module/zcommon/zfeature_common.c, and document it in man/man7/zpool-features.7. Gate writes and follow existing activation and spa_feature_incr()/decr() patterns; enabled is not the same as active.dmu_replay_record or DRR_* changes with maintainers and use appropriate stream flags.libzfs, libzfs_core, libnvpair and libzfsbootenv. make checkabi compares built libraries with lib/*/*.abi on x86_64 (libabigail >= 2.0). New exports are allowed; do not break existing signatures. Run make storeabi only for intentional, reviewed ABI updates.zfs_ioctl_register() and nvlist validation via zfs_keys_* tables; libzfs_core provides stable lzc_* wrappers.man/man7/zfsprops.7 and man/man7/zpoolprops.7; man pages use mdoc.tests/zfs-tests/tests/functional/<area>/<name>.ksh, source $STF_SUITE/include/libtest.shlib, use log_* helpers, verify_runnable "global"|"both", and log_onexit cleanup. .cfg, .kshlib and .shlib files must not be executable (testscheck).tests/zfs-tests/tests/Makefile.am (make regen-tests) and tests/runfiles/common.run or the platform runfile. make regen-tests runs make clean for the whole build; rebuild before testing, or edit the entries manually to preserve built artifacts. Missing runfile entries exclude tests from that suite, though explicit -t still works. Missing Makefile.am entries prevent installation of the test.$TESTDIR/$TESTPOOL, never fixed host devices or unrelated paths. Clean up pools, datasets, devices and mounts on failure.zinject, zdb, events, zfs_dbgmsg and kstats (/proc/spl/kstat on Linux, sysctl kstat.zfs on FreeBSD), rather than adding debug-only ioctls or properties. Do not hide introduced failures in tests/test-runner/bin/zts-report.py.in expected-failure/skip lists.--enable-debuginfo adds -fno-inline and changes performance.master; use commit subject/body lines <= 72 characters and end the message with Signed-off-by: Name <email> (git commit -s).make commitcheck validates HEAD, not the uncommitted patch.ZFS-CI-Type: full or quick in the commit body when needed; follow CONTRIBUTING.md for override precedence.configure, Makefile.in, zfs_config.h, editor files or build output; .abi updates require the review described above.