Fix RAID-Z expansion progress overflow, hot spare UNAVAIL handling, and scrub method persistence #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses three core ZFS bugs: RAID-Z expansion progress exceeding 100%, hot spares failing to activate for UNAVAIL devices, and scrub method reverting after pool export/import.
Changes
RAID-Z Expansion Progress Calculation
Progress could exceed 100% when new data was written during expansion.
pres_to_reflowwas calculated fromvd->vdev_stat.vs_allocwhich grows dynamically.vre_bytes_to_copyfield tovdev_raidz_expand_tto capture initial allocation at expansion startVDEV_TOP_ZAP_RAIDZ_EXPAND_BYTES_TO_COPYkeyspa_raidz_expand_get_stats()to use fixed value, falling back tovs_allocfor backward compatibilityHot Spare Auto-Activation
ZED retire agent only triggered replacement for
VDEV_STATE_REMOVEDandVDEV_STATE_FAULTED, missingVDEV_STATE_CANT_OPEN(UNAVAIL state).zfs_retire_recv()to includeVDEV_STATE_CANT_OPENScrub Method Persistence
scn_is_sortedflag was not persisted indsl_scan_phys_t, causing sequential scans to revert to legacy after pool reimport.DSF_SORTED_SCANflag todsl_scan_flags_tscn_phys.scn_flagswhen enabling sorted scanscn_is_sortedfrom flag duringdsl_scan_init()Not Addressed
Project quota initialization after pool upgrade requires traversing all open objsets, which is too invasive. Existing code already handles upgrade on mount—users must remount datasets after enabling the feature.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.