Repository navigation
Parity sets: deferred, dedicated P/Q parity across independent pools #19956
Replies: 3 comments 1 reply
|
The code is on johnpwhite/zfs Kernel (12,676 lines, 41 files). Eight new files hold 10,668 lines: parity capture and state ( Libraries (609 lines). Tools (743 lines). Man pages (677 lines, 9 files). The new page Tests (9,575 lines, 39 % of the total). The ZFS Test Suite group Generated (299 lines). The Without tests and generated files, the change is 14,706 lines. For comparison: dRAID added 10,120 lines, Direct I/O 5,998 and RAID-Z expansion 5,737, each with its tests. |
Etc. etc. etc. |
|
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I have built a prototype of a feature, and before I go further I would like to know if there is interest and what you think of the design. The ZFS-side series is on my fork (link below). It is six commits on current master, with tests.
In short: dedicated, non-striped parity (one or two parity disks, P and Q as in raidz2) across independent pools, updated a little after each write instead of with it. Each data disk stays a complete pool of its own.
This is a sibling of my asynchronous-mirror discussion (#19890), and like that one it is AI-written code that the maintainers would likely want to rework; see "How this was built" below.
How this was built
I designed this and made the design decisions; the code, tests and man pages were written with AI coding agents (Claude Opus 5.5 and Fable, with Codex for reviews and diversity of "thought"), under my direction and review:
The problem
Many home and small-office users want a parity-protected set of independent disks: disks of mixed sizes, each disk readable on its own, idle disks spun down, and one or two parity disks that protect the whole set. Today they choose between ZFS (checksums and self-healing, but raidz needs all disks spinning, equal-ish sizes and a whole pool lost past its redundancy) and an array outside ZFS (independent disks, but the file system on each disk cannot heal itself from parity).
The idea
A parity set is a group of independent pools that share one or two parity disks (P, or P and Q).
What the ZFS change adds
parityset. While it is on, each txg records the ranges it allocates and frees (in the MOS, in the same txg as the data), under a new read-only-compatible featureorg.openzfs:parity_records. A host without the feature can still import a member read-only.parity_pace=on), so the pool stays protected and parity never falls far behind. Pacing acts only while the service reports progress: if the service stops, writes run at full speed, and at the limit the pool by default drops its records, keeps writing, posts an event and reports "not protected, resync needed" (parity_onstall=continue;waitblocks writers instead). The limits are pool properties.lzc_parity_*): INFO, RECORDS, APPLIED, CURRENT, LABEL (the set identity of a txg), MAP and BLOCKS (allocated ranges and block pointers at a txg), READ/READV, VERIFY, REPAIR, a repair provider (PROVIDER/SUPPLY) for the read path, DROP and a staged RECLAIM of leaked held space.zpool addandzpool attachon a member are supported. raidz, draid, special and dedup vdevs are refused: such a pool already has its own redundancy.zfs/<pool>/parity_setthat publishes the state (applied and synced txg, pending and held bytes, throttle time, repair counts) without any service.zpool-parity.8and updates tozpoolprops.7,zpool-features.7,zfs.4,zdb.8and others).spa_lag.c), so another lagging consumer could share it; an asynchronous-mirror prototype on my fork uses the same patterns.Two small fixes outside the feature are their own commits: the unload txg time log is written in syncing context, and the DTL of a leaf under a running sequential rebuild is kept.
Testing so far
parity_setgroup (53 cases: life cycle, records, repair on read with and without a provider, reclaim, import alone, multi-vdev members, replace races, the kstat), all passing in a VM on Linux 6.18.ztest -Zruns a file vdev as a parity member with a consumer thread;libzfs_input_checkcovers each ioctl.zpool addon a live member.Prior art
The layout is not new: Unraid keeps real-time dedicated parity over independent disks, and SnapRAID computes snapshot parity on demand. This design keeps the layout and puts the timing between the two: parity follows each txg, and held frees leave no unprotected window. It also uses the ZFS block checksums: a block rebuilt from parity is written back only when it matches its block pointer.
Questions for you
zed)? Should the service itself be offered for the tree?spa_lag.c): useful, or would you rather see each feature self-contained?zfs_parity_repair_wait_ms) for a provider to supply bytes, which ZFS verifies against the block pointer. Is a synchronous wait in the read path acceptable, or should it be asynchronous only (fail the read, repair later)?Code: https://github.com/johnpwhite/zfs/tree/parity-set (six commits on master
c913da861).Thanks for any feedback.
All reactions